import sys input = sys.stdin.readline N,M=map(int,input().split()) def calc(x): score=0 for i in range(1,M+1): score+=x%i return score ANS=0 for i in range(N-100,N+1): if i<=0: pass else: ANS=max(ANS,calc(i)) print(ANS)