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