a,b=map(int,input().split()) x=a%b if x<0: x-=b print(x)