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(); long total = 0; ArrayList primes = new ArrayList<>(); for (int i = 2; i * (n - 1) <= m; i++) { if (isPrime(i, primes)) { primes.add(i); total += m - i * (n - 1) + 1; } } System.out.println(total); } static boolean isPrime(int x, ArrayList primes) { for (int y : primes) { if (Math.sqrt(x) < y) { break; } if (x % y == 0) { return false; } } return true; } }