#include using namespace std; int main(){ ios::sync_with_stdio(false); int n, m; cin >> n >> m; cout << (n/m)-(n/m)%1000 << "\n"; return 0; }