def main(n: int, k: int):
    if k == 1:
        print(0)
        return

    print(n - k)


if __name__ == "__main__":
    n, k = map(int, input().split())

    main(n, k) def main(n: int, k: int):
    if k == 1:
        print(0)
        return

    print(n - k) main if k == 1:
        print(0)
        return

     k == 1 k 1 print(0) print 0 return print(n - k) print n - k n k n: int n k: int k if __name__ == "__main__":
    n, k = map(int, input().split())

    main(n, k) __name__ == "__main__" __name__ "__main__" n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k main(n, k) main n k n, k = map(int, input().split()) map(int, input().split()) n def main(n: int, k: int):
    if k == 1:
        print(0)
        return

    print(n - k) def main(n: int, k: int):
    if k == 1:
        print(0)
        return

    print(n - k) main k = map(int, input().split()) map(int, input().split()) k
def main(n: int, k: int):
    if k == 1:
        print(0)
        return

    print(n - k)


if __name__ == "__main__":
    n, k = map(int, input().split())

    main(n, k)
