#include using namespace std; int main(){ int a,b;cin>>a>>b; int ans = 0; for(int i = 1; a >= i*i; i++){ if(a%i == 0){ if(i%b == 0)ans++; if(a != i*i && (a/i)%b == 0)ans++; } } cout << ans << endl; }