def resolve():
    A, B = map(int, input().split())
    print("0" if B == 1 else A-B)
resolve() def resolve():
    A, B = map(int, input().split())
    print("0" if B == 1 else A-B) resolve A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B print("0" if B == 1 else A-B) print "0" if B == 1 else A-B B == 1 B 1 "0" A-B A B resolve() resolve def resolve():
    A, B = map(int, input().split())
    print("0" if B == 1 else A-B) def resolve():
    A, B = map(int, input().split())
    print("0" if B == 1 else A-B) resolve
def resolve():
    A, B = map(int, input().split())
    print("0" if B == 1 else A-B)
resolve()