#include #include #include #include #define REP(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int N, P; cin >> N >> P; vector can(N+1); can[P] = true; for (int ii = 0; ii < 2; ii++) { for (int i = N; i >= 2; i--) { for (int j = i*2; j <= N; j += i) { can[i] = can[i] || can[j]; } } for (int i = 2; i <= N; i++) { for (int j = i*2; j <= N; j += i) { can[j] = can[j] || can[i]; } } } int ans = count(can.begin(), can.end(), true); cout << ans << '\n'; }