#include using namespace std; #define REP(i, a, n) for(int i=a; i=a; i--) #define ll long long int main() { ll W, D; cin >> W >> D; RREP(i, 2, D + 1) { W -= (W / (i*i)); } cout << W << endl; return 0; }