from sys import stdin ## input functions for me def ria(sep = ''): if sep == '' : return list(map(int, input().split())) else: return list(map(int, input().split(sep))) def rsa(sep = ''): if sep == '' : return input().split() else: return input().split(sep) def ri(): return int(input()) def rd(): return float(input()) def rs(): return input() ## ## main ## N, K = map(int, input().split()) F = N * (N + 1) // 2 M = F - 2 * (K * (N + N - 1 * (K - 1)) // 2) print ((F - M) // 2 + 1)