N,K = [int(x) for x in input().split()]
print(N%K) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x N,K = [int(x) for x in input().split()] N [int(x) for x in input().split()] K print(N%K) print N%K N K K = [int(x) for x in input().split()] [int(x) for x in input().split()] K N,K = [int(x) for x in input().split()] [int(x) for x in input().split()] N
N,K = [int(x) for x in input().split()]
print(N%K)