N,K = [int(x) for x in input().split()]
if K >= 2:
    print(N-K)
else:
    print(0) 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 if K >= 2:
    print(N-K)
else:
    print(0) K >= 2 K 2 print(N-K) print N-K N K print(0) print 0 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()]
if K >= 2:
    print(N-K)
else:
    print(0)