import sys

input = sys.stdin.readline


def main():
    N, K = map(int, input().split())

    if K == 1:
        ans = 0
    else:
        ans = N - K

    print(ans)


if __name__ == "__main__":
    main() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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 input = sys.stdin.readline sys.stdin.readline input
import sys

input = sys.stdin.readline


def main():
    N, K = map(int, input().split())

    if K == 1:
        ans = 0
    else:
        ans = N - K

    print(ans)


if __name__ == "__main__":
    main()
