import java.util.*; public class Main { static boolean[] used; static int n; public static void main (String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); used = new boolean[n + 1]; int p = sc.nextInt(); for (int i = 2; i <= Math.sqrt(p); i++) { if (p % i == 0) { setUse(i); p /= i; while (p % i == 0) { p /= i; } } } if (p > 1) { setUse(p); } int count = 0; for (int i = 1; i <= n; i++) { if (used[i]) { count++; } } System.out.println(count); } static void setUse(int x) { if (used[x]) { return; } used[x] = true; for (int i = 2; i * x <= n; i++) { used[i * x] = true; setUse(i); } } }