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