if __name__ == "__main__":
    n,k = input().split()
    n = int(n)
    k = int(k)
    if k == 1:
        print(0)
    else:
        print(n-k) if __name__ == "__main__":
    n,k = input().split()
    n = int(n)
    k = int(k)
    if k == 1:
        print(0)
    else:
        print(n-k) __name__ == "__main__" __name__ "__main__" n,k = input().split() n input().split() ().split () input split k n = int(n) n int(n) int n k = int(k) k int(k) int k 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 n,k = input().split() input().split() n n = int(n) int(n) n k = input().split() input().split() k k = int(k) int(k) k
if __name__ == "__main__":
    n,k = input().split()
    n = int(n)
    k = int(k)
    if k == 1:
        print(0)
    else:
        print(n-k)