n, k = map(int, input().split()) al = sorted([int(i) for i in range(n)]) while al: if sum(al) <= k: break al = al[:-1] print(sum(al))