A, B = map(int, input().split()) if B > 0: print(A % B) else: print(A % B - B)