def main():
    n, k = map(int, input().split())

    if k == 1:
        ans = 0
    else:
        ans = n - k

    print(ans)


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

    if k == 1:
        ans = 0
    else:
        ans = n - k

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

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

    if k == 1:
        ans = 0
    else:
        ans = n - k

    print(ans) def main():
    n, k = map(int, input().split())

    if k == 1:
        ans = 0
    else:
        ans = n - k

    print(ans) main
def main():
    n, k = map(int, input().split())

    if k == 1:
        ans = 0
    else:
        ans = n - k

    print(ans)


if __name__ == "__main__":
    main()
