//直接出一个k 使得k*num2>num1 然后num1-(k-1)num2
#include"iostream"
using namespace std;int main()
{
int num1,num2;
while(scanf("%d%d",&num1,&num2)!=EOF)
{
int k=0;
while(num1>=num2*k)
{
k++;
}
cout<<num1-num2*(k-1)<<endl;
}
return 0;
}
//直接出一个k 使得k*num2>num1 然后num1-(k-1)num2
#include"iostream"
using namespace std;}