ball, people = map(int,input().split())

if people == 1:
    print(0)
else:
    print(ball - people) ball, people = map(int,input().split()) ball map(int,input().split()) map int input().split() ().split () input split people if people == 1:
    print(0)
else:
    print(ball - people) people == 1 people 1 print(0) print 0 print(ball - people) print ball - people ball people ball, people = map(int,input().split()) map(int,input().split()) ball people = map(int,input().split()) map(int,input().split()) people
ball, people = map(int,input().split())

if people == 1:
    print(0)
else:
    print(ball - people)