def solve():
    N, K = map(int, input().split())
    if K == 1:
        print(0)
    else:
        print(N - K)


if __name__ == '__main__':
    solve() def solve():
    N, K = map(int, input().split())
    if K == 1:
        print(0)
    else:
        print(N - K) solve N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split 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 if __name__ == '__main__':
    solve() __name__ == '__main__' __name__ '__main__' solve() solve def solve():
    N, K = map(int, input().split())
    if K == 1:
        print(0)
    else:
        print(N - K) def solve():
    N, K = map(int, input().split())
    if K == 1:
        print(0)
    else:
        print(N - K) solve
def solve():
    N, K = map(int, input().split())
    if K == 1:
        print(0)
    else:
        print(N - K)


if __name__ == '__main__':
    solve()
