import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 2); int n = Integer.parseInt(first[0]); int p = Integer.parseInt(first[1]); TreeSet prime = new TreeSet<>(); for (int i = 2; i <= Math.sqrt(p); i++) { while (p % i == 0) { prime.add(i); p /= i; } } if (p != 1) { prime.add(p); } int x = prime.first(); for (int i = 2; i * x <= n; i++) { if (isPrime(i)) { prime.add(i); } } x = prime.first(); for (int i = 2; i * x <= n; i++) { if (isPrime(i)) { prime.add(i); } } HashSet set = new HashSet<>(); for (int y : prime) { for (int i = 1; i * y <= n; i++) { set.add(i * y); } } System.out.println(set.size()); } static boolean isPrime(int x) { for (int i = 2; i <= Math.sqrt(x); i++) { if (x % i == 0) { return false; } } return true; } }