splited = input().split(' ')
N = int(splited[0])
K = int(splited[1])
 
if(K == 1):
    print(0)
else:
    print(N - K) splited = input().split(' ') splited input().split(' ') ().split () input split ' ' N = int(splited[0]) N int(splited[0]) int splited[0] splited 0 K = int(splited[1]) K int(splited[1]) int splited[1] splited 1 if(K == 1):
    print(0)
else:
    print(N - K) K == 1 K 1 print(0) print 0 print(N - K) print N - K N K K = int(splited[1]) int(splited[1]) K N = int(splited[0]) int(splited[0]) N splited = input().split(' ') input().split(' ') splited
splited = input().split(' ')
N = int(splited[0])
K = int(splited[1])
 
if(K == 1):
    print(0)
else:
    print(N - K)