#include using namespace std; typedef long long ll; typedef pair l_l; typedef pair i_i; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) //const ll mod = 1000000007; struct UnionFind { vector par; vector rank; vector Size; UnionFind(int n = 1) { init(n); } void init(int n = 1) { par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1); for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1; } int root(int x) { if (par[x] == x) { return x; } else { int r = root(par[x]); return par[x] = r; } } bool issame(int x, int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (rank[x] < rank[y]) swap(x, y); if (rank[x] == rank[y]) ++rank[x]; par[y] = x; Size[x] += Size[y]; return true; } ll size(int x){ return Size[root(x)]; } }; int main() { //cout.precision(10); cin.tie(0); ios::sync_with_stdio(false); int N, P; cin >> N >> P; UnionFind uni(1000500); for(int i = 2; i <= N; i++) { for(int j = 2 * i; j <= N; j += i) { uni.merge(j, j - i); } } cout << uni.size(P) << endl; return 0; }