
def main():
    # parse
    x, y = parse() 
    if y == 1:
        print(0)
    else:
        print(x - y)

def parse():
    vars = split_stdin(get_stdin())
    # var = get_stdin()
    return  int(vars[0]), int(vars[1]) 

def get_stdin():
    return input()

def split_stdin(stdin_val, delim = ' '):
    return [x for x in stdin_val.split(delim) if x != '']

if __name__ == "__main__":
    main() def main():
    # parse
    x, y = parse() 
    if y == 1:
        print(0)
    else:
        print(x - y) main x, y = parse() x parse() parse y if y == 1:
        print(0)
    else:
        print(x - y) y == 1 y 1 print(0) print 0 print(x - y) print x - y x y def parse():
    vars = split_stdin(get_stdin())
    # var = get_stdin()
    return  int(vars[0]), int(vars[1])  parse vars = split_stdin(get_stdin()) vars split_stdin(get_stdin()) split_stdin get_stdin() get_stdin return  int(vars[0]), int(vars[1]) return  int(vars[0]), int(vars[1]) int(vars[0]) int vars[0] vars 0 int(vars[1]) int vars[1] vars 1 def get_stdin():
    return input() get_stdin return input() input() input def split_stdin(stdin_val, delim = ' '):
    return [x for x in stdin_val.split(delim) if x != ''] split_stdin x for x in stdin_val.split(delim) if x != '' for x in stdin_val.split(delim) if x != '' x stdin_val.split(delim) stdin_val.split stdin_val split delim x != '' x '' if x != '' x return [x for x in stdin_val.split(delim) if x != ''] [x for x in stdin_val.split(delim) if x != ''] stdin_val stdin_val delim = ' ' delim ' ' if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def split_stdin(stdin_val, delim = ' '):
    return [x for x in stdin_val.split(delim) if x != ''] def split_stdin(stdin_val, delim = ' '):
    return [x for x in stdin_val.split(delim) if x != ''] split_stdin def parse():
    vars = split_stdin(get_stdin())
    # var = get_stdin()
    return  int(vars[0]), int(vars[1])  def parse():
    vars = split_stdin(get_stdin())
    # var = get_stdin()
    return  int(vars[0]), int(vars[1])  parse def get_stdin():
    return input() def get_stdin():
    return input() get_stdin def main():
    # parse
    x, y = parse() 
    if y == 1:
        print(0)
    else:
        print(x - y) def main():
    # parse
    x, y = parse() 
    if y == 1:
        print(0)
    else:
        print(x - y) main

def main():
    # parse
    x, y = parse() 
    if y == 1:
        print(0)
    else:
        print(x - y)

def parse():
    vars = split_stdin(get_stdin())
    # var = get_stdin()
    return  int(vars[0]), int(vars[1]) 

def get_stdin():
    return input()

def split_stdin(stdin_val, delim = ' '):
    return [x for x in stdin_val.split(delim) if x != '']

if __name__ == "__main__":
    main()