import math def sieve (n): check = [1]*(n+1) check[0] = check[1] = 0 for d in xrange(2,int(math.sqrt(n))+1): if check[d] == 0: continue for comp in xrange(d*2,n+1,d): check[comp] = 0 return check N,L = map(int,raw_input().split()) if L < 5: print 0 quit() prime = sieve(L/(N-1)+1) M = 0 for i in xrange(2,L/(N-1)+1): if prime[i] == 0: continue if i * (N-1) <= L: M += L+1 - i*(N-1) print M