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