include<bits/stdc++.h>

using namespace std;
int main()
{
int a,b,c=0;
cin>>a>>b;
c=a%b;
cout<<c;
return 0;
}