#include using namespace std; int main(){ int64_t s, k; cin >> s >> k; cout << s % k << endl; }