N,L = map(int,input().split()) NL = L // (N - 1) if NL == 0: print(0) exit() X = [1] * (NL + 1) X[0] = 0 X[1] = 0 for i in range(NL): if X[i] == 1: for j in range(2,NL//i + 1): X[i * j] = 0 NP = sum(X) ans = NP * (L + 1) tmp = 0 for i in range(NL + 1): if X[i] == 1: tmp += i ans -= tmp * (N - 1) print(ans)