A, B = map(int, input().split()) B = abs(B) print(A % B)