n, k = map(int, input().split())

if n // k <= 0:
    print(0)
elif k == 1:
    print(0)
else:
    max_num = n - k + 1
    print(max_num - 1) n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k if n // k <= 0:
    print(0)
elif k == 1:
    print(0)
else:
    max_num = n - k + 1
    print(max_num - 1) n // k <= 0 n // k n k 0 print(0) print 0 elif k == 1:
    print(0) k == 1 k 1 print(0) print 0 max_num = n - k + 1 max_num n - k + 1 n - k n k 1 print(max_num - 1) print max_num - 1 max_num 1 n, k = map(int, input().split()) map(int, input().split()) n k = map(int, input().split()) map(int, input().split()) k max_num = n - k + 1 n - k + 1 max_num
n, k = map(int, input().split())

if n // k <= 0:
    print(0)
elif k == 1:
    print(0)
else:
    max_num = n - k + 1
    print(max_num - 1)