#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define eps 0.000001 #define LONG_INF 10000000000000 #define GOLD 1.61803398874989484820458 #define seg_size 65536*4 #define REP(i,n) for(long long i = 0;i < n;++i) unsigned long xor128() { static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123; unsigned long t = (x ^ (x << 11)); x = y; y = z; z = w; return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))); } int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } long long visited[2000000] = {}; long long nekoi[2000000] = {}; int main() { int n, k; cin >> n >> k; if (k == 1) { cout << 1 << endl; return 0; } visited[k] = 1; queue now; now.push(k); while (now.empty() == false) { int next = now.front(); now.pop(); for (int i = 2; i <= sqrt(next); ++i) { if (next % i == 0) { int nya = i; if (nekoi[nya] == 0) { nekoi[nya] = 1; for (int j = 1; j * nya <= n; ++j) { if (visited[j * nya] == 0) { visited[j * nya] = 1; now.push(j * nya); } nekoi[j * nya] = 1; } } nya = next / i; if (nekoi[nya] == 0) { nekoi[nya] = 1; for (int j = 1; j * nya <= n; ++j) { if (visited[j * nya] == 0) { visited[j * nya] = 1; now.push(j * nya); } nekoi[j * nya] = 1; } } } } } long long ans = 0; for (int i = 1; i <= n; ++i) { ans += visited[i]; } cout << ans << endl; return 0; }