#

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

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

if __name__ == '__main__':
    main() import itertools itertools from collections import Counter from collections import defaultdict import bisect bisect from heapq import heappush, heappop def main():
    N, K = map(int, input().split())
    rest = N - K
    if K == 1:
        print(0)
    else:
        print(rest) main N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K rest = N - K rest N - K N K if K == 1:
        print(0)
    else:
        print(rest) K == 1 K 1 print(0) print 0 print(rest) print rest if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N, K = map(int, input().split())
    rest = N - K
    if K == 1:
        print(0)
    else:
        print(rest) def main():
    N, K = map(int, input().split())
    rest = N - K
    if K == 1:
        print(0)
    else:
        print(rest) main
#

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

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

if __name__ == '__main__':
    main()
