S,K = map(int, input()) print(S%K)