class BallDistribution:
    def __init__(self):
        self.N, self.K = map(int, input().split())

    def max_number(self):
        if self.K == 1:
            print(0)
        else:
            print(self.N - self.K)


ballDistribution = BallDistribution()
ballDistribution.max_number() class BallDistribution:
    def __init__(self):
        self.N, self.K = map(int, input().split())

    def max_number(self):
        if self.K == 1:
            print(0)
        else:
            print(self.N - self.K) BallDistribution def __init__(self):
        self.N, self.K = map(int, input().split())

     __init__ self.N, self.K = map(int, input().split()) self.N self N map(int, input().split()) map int input().split() ().split () input split self.K self K self self def max_number(self):
        if self.K == 1:
            print(0)
        else:
            print(self.N - self.K) max_number if self.K == 1:
            print(0)
        else:
            print(self.N - self.K) self.K == 1 self.K self K 1 print(0) print 0 print(self.N - self.K) print self.N - self.K self.N self N self.K self K self self ballDistribution = BallDistribution() ballDistribution BallDistribution() BallDistribution ballDistribution.max_number() ballDistribution.max_number ballDistribution max_number ballDistribution = BallDistribution() BallDistribution() ballDistribution class BallDistribution:
    def __init__(self):
        self.N, self.K = map(int, input().split())

    def max_number(self):
        if self.K == 1:
            print(0)
        else:
            print(self.N - self.K) class BallDistribution:
    def __init__(self):
        self.N, self.K = map(int, input().split())

    def max_number(self):
        if self.K == 1:
            print(0)
        else:
            print(self.N - self.K) BallDistribution
class BallDistribution:
    def __init__(self):
        self.N, self.K = map(int, input().split())

    def max_number(self):
        if self.K == 1:
            print(0)
        else:
            print(self.N - self.K)


ballDistribution = BallDistribution()
ballDistribution.max_number()
