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