import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int length = m / (n - 1) + 1; boolean[] isPrime = new boolean[length]; long total = 0; for (int i = 2; i * (n - 1) <= m; i++) { if (!isPrime[i]) { total += m - i * (n - 1) + 1; for (int j = i * 2; j < length; j += i) { isPrime[j] = true; } } } System.out.println(total); } }