import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N,L = map(int,read().split()) U = 10 ** 7 is_prime = np.zeros(U,np.bool) is_prime[2] = 1 is_prime[3::2] = 1 for p in range(3,U,2): if p*p >= U: break if is_prime[p]: is_prime[p*p::p+p] = 0 primes = np.where(is_prime)[0] D = primes * (N-1) answer = np.maximum(0, L - D + 1).sum() print(answer)