n,k = map(int,input().split())
print(max(n-k,1) if k > 1 and k != n else 0) n,k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k print(max(n-k,1) if k > 1 and k != n else 0) print max(n-k,1) if k > 1 and k != n else 0 k > 1 and k != n k > 1 k 1 k != n k n max(n-k,1) max n-k n k 1 0 k = map(int,input().split()) map(int,input().split()) k n,k = map(int,input().split()) map(int,input().split()) n
n,k = map(int,input().split())
print(max(n-k,1) if k > 1 and k != n else 0)