# -*- coding: utf-8 -*-

a,b = map(int,input().split())

def main():
    if(b==1):
        print(0)    
    else:
        print(a-b)


if __name__ == "__main__":
    main() a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def main():
    if(b==1):
        print(0)    
    else:
        print(a-b) main if(b==1):
        print(0)    
    else:
        print(a-b) b==1 b 1 print(0) print 0 print(a-b) print a-b a b if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    if(b==1):
        print(0)    
    else:
        print(a-b) def main():
    if(b==1):
        print(0)    
    else:
        print(a-b) main a,b = map(int,input().split()) map(int,input().split()) a b = map(int,input().split()) map(int,input().split()) b
# -*- coding: utf-8 -*-

a,b = map(int,input().split())

def main():
    if(b==1):
        print(0)    
    else:
        print(a-b)


if __name__ == "__main__":
    main()