#include using namespace std; int w,d; int main(){ cin>>w>>d; while(d>1){ w-=w/d/d; d--; } cout<