#include using namespace std; int main() { int N, P; { cin >> N >> P; } vector sz(N + 1, 1); vector fa(N + 1); { iota(fa.begin(), fa.end(), 0); } function find = [&](int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }; function unite = [&](int x, int y) { int fx = find(x); int fy = find(y); if (fx == fy) return; sz[fx] += sz[fy]; fa[fy] = fx; }; vector np(N + 1); { for (int i = 2; i <= N; ++i) { for (int j = i + i; j <= N; j += i) { unite(i, j); } } } cout << sz[find(P)] << endl; }