import java.util.Scanner; import java.util.HashSet; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); HashSet list = new HashSet(); list.add(A); for(int i=1;i<=Math.sqrt(A);i++) if(A%i==0){ list.add(i); list.add(A/i); } int ans = 0; for(int tmp:list) if(tmp%B==0) ans++; System.out.println(ans); } }