a,b = map(int,input().split()) p = a//b q = a-p*b print(abs(q))