import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, K] = [int(input_raw[0]), int(input_raw[1])]
    if (K == 1):
        print 0
    else:
        print (N - (K - 1)- 1)


if __name__ == '__main__':
    main() import sys sys from collections import deque import copy copy import math math def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline get_read_func if fileobject == None :
        return raw_input
    else:
        return fileobject.readline fileobject == None fileobject None return raw_input raw_input return fileobject.readline fileobject.readline fileobject readline fileobject fileobject def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, K] = [int(input_raw[0]), int(input_raw[1])]
    if (K == 1):
        print 0
    else:
        print (N - (K - 1)- 1) main if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
     len(sys.argv) > 1 len(sys.argv) len sys.argv sys argv 1 f = open(sys.argv[1]) f open(sys.argv[1]) open sys.argv[1] sys.argv sys argv 1 f = None f None read_func = get_read_func(f) read_func get_read_func(f) get_read_func f input_raw = read_func().strip().split() input_raw read_func().strip().split() ().strip().split ().strip() ().strip () read_func strip split [N, K] = [int(input_raw[0]), int(input_raw[1])] [N, K] N K [int(input_raw[0]), int(input_raw[1])] int(input_raw[0]) int input_raw[0] input_raw 0 int(input_raw[1]) int input_raw[1] input_raw 1 if (K == 1):
        print 0
    else:
        print (N - (K - 1)- 1) K == 1 K 1 print print (N - (K - 1)- 1) print N - (K - 1)- 1 N - (K - 1) N K - 1 K 1 1 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline get_read_func def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, K] = [int(input_raw[0]), int(input_raw[1])]
    if (K == 1):
        print 0
    else:
        print (N - (K - 1)- 1) def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, K] = [int(input_raw[0]), int(input_raw[1])]
    if (K == 1):
        print 0
    else:
        print (N - (K - 1)- 1) main
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, K] = [int(input_raw[0]), int(input_raw[1])]
    if (K == 1):
        print 0
    else:
        print (N - (K - 1)- 1)


if __name__ == '__main__':
    main()
