#include<bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::cerr;
namespace xxy {
#define int long long
#define double long double
int n, k;
bool vis[70];
const double one = 1;
std::vector<int> used;
int calc(int lim, int j)
{
int add = pow((double)lim, one / used[j]);
int re = 0;
re += add-1;
for(int i = 0; i < j; i++) {
re -= calc(add, i);
}
return re;
}
signed main()
{
cin >> n >> k;
if(k == 1) {
cout << n;
return 0;
}
int lim = (log(n) / log(2));
int ans = 0;
for(int i = k; i <= lim; i++) {
if(vis[i])continue;
for(int j = 1; j * i <= lim; j++) {
vis[j * i] = true;
}
used.push_back(i);
ans+=calc(n,used.size()-1);
}
cout << ans+1;
return 0;
}
}
signed main()
{
std::ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
return xxy::main();
}