#include using namespace std; int main(){ long int n, k; cin >> n >> k; if (k == 0 || k > n) cout << 0 << endl; else{ if (n == k) cout << n - (n / k) -1 << endl; else cout << n-(n/k) << endl; } }