// D問題 #include using namespace std; using ll = long long; vector > prime_factorize(long long N) { vector > res; for (long long a = 2; a * a <= N; ++a) { if (N % a != 0) continue; long long ex = 0; while (N % a == 0) { ++ex; N /= a; } res.push_back({a, ex}); } if (N != 1) res.push_back({N, 1}); return res; } int main() { ll n, k; cin >> n >> k; ll N=n-k; const auto &pf = prime_factorize(N); ll res=1; for(auto p : pf) res *= p.second + 1; if(k==0) { cout << res << endl; } else { cout << res-1 << endl; } }