#include using namespace std; typedef long long LL; int main() { cin.tie(0); ios::sync_with_stdio(false); LL n; int m; cin >> n >> m; if(n <= 1000){ cout << 0 << endl; return 0; } for(LL i = 0; i != n; i += 1000){ if((n - i) % m == 0){ cout << (n - i) / m << endl; return 0; } } return 0; }