#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

class Factorial:
    def __init__(self,MOD):
        self.MOD = MOD
        self.factorials = [1,1] # 階乗を求めるためのキャッシュ
        self.invModulos = [0,1] # n^-1のキャッシュ
        self.invFactorial_ = [1,1] # (n^-1)!のキャッシュ

    def calc(self,n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0]*(n+1-len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = prev * i%m
        self.factorials += nextArr
        return self.factorials[n]
    
    def inv(self,n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        p = self.MOD
        pi = n%p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0]*(n+1-len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI,min(p,n+1)):
            next = -self.invModulos[p%i]*(p//i)%p
            self.invModulos.append(next)
        return self.invModulos[pi]
    
    def invFactorial(self,n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n) # To make sure already calculated n^-1
        nextArr = [0]*(n+1-len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = (prev * self.invModulos[i%p])%p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n]


class Combination:
    def __init__(self,MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)
    
    def choose_k_from_n(self,n,k):
        if k < 0 or n < k:
            return 0
        k = min(k,n-k)
        f = self.factorial
        return f.calc(n)*f.invFactorial(max(n-k,k))*f.invFactorial(min(k,n-k))%self.MOD


def solve(n: int, k: int):
    c = Combination(MOD)
    sum = 0
    for i in range(min(n,k+1)-1,-1,-1):
        c1 = c.choose_k_from_n(n,i)
        c2 = c.choose_k_from_n(n-1,i)
        sum = (sum + c1*c2)%MOD
    print(sum)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    solve(n, k)

if __name__ == '__main__':
    main() import sys sys MOD = 1000000007 MOD 1000000007 class Factorial:
    def __init__(self,MOD):
        self.MOD = MOD
        self.factorials = [1,1] # 階乗を求めるためのキャッシュ
        self.invModulos = [0,1] # n^-1のキャッシュ
        self.invFactorial_ = [1,1] # (n^-1)!のキャッシュ

    def calc(self,n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0]*(n+1-len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = prev * i%m
        self.factorials += nextArr
        return self.factorials[n]
    
    def inv(self,n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        p = self.MOD
        pi = n%p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0]*(n+1-len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI,min(p,n+1)):
            next = -self.invModulos[p%i]*(p//i)%p
            self.invModulos.append(next)
        return self.invModulos[pi]
    
    def invFactorial(self,n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n) # To make sure already calculated n^-1
        nextArr = [0]*(n+1-len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = (prev * self.invModulos[i%p])%p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n] Factorial def __init__(self,MOD):
        self.MOD = MOD
        self.factorials = [1,1] # 階乗を求めるためのキャッシュ
        self.invModulos = [0,1] # n^-1のキャッシュ
        self.invFactorial_ = [1,1] # (n^-1)!のキャッシュ

     __init__ self.MOD = MOD self.MOD self MOD MOD self.factorials = [1,1] self.factorials self factorials [1,1] 1 1 self.invModulos = [0,1] self.invModulos self invModulos [0,1] 0 1 self.invFactorial_ = [1,1] self.invFactorial_ self invFactorial_ [1,1] 1 1 self self MOD MOD def calc(self,n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0]*(n+1-len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = prev * i%m
        self.factorials += nextArr
        return self.factorials[n]
    
     calc if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
         n <= -1 n -1 print("Invalid argument to calculate n!") print "Invalid argument to calculate n!" print("n must be non-negative value. But the argument was " + str(n)) print "n must be non-negative value. But the argument was " + str(n) "n must be non-negative value. But the argument was " str(n) str n exit() exit if n < len(self.factorials):
            return self.factorials[n]
         n < len(self.factorials) n len(self.factorials) len self.factorials self factorials return self.factorials[n] self.factorials[n] self.factorials self factorials n nextArr = [0]*(n+1-len(self.factorials)) nextArr [0]*(n+1-len(self.factorials)) [0] 0 n+1-len(self.factorials) n+1 n 1 len(self.factorials) len self.factorials self factorials initialI = len(self.factorials) initialI len(self.factorials) len self.factorials self factorials prev = self.factorials[-1] prev self.factorials[-1] self.factorials self factorials -1 m = self.MOD m self.MOD self MOD for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = prev * i%m
         i range(initialI,n+1) range initialI n+1 n 1 prev = nextArr[i-initialI] = prev * i%m prev prev * i%m prev * i prev i m = nextArr[i-initialI] = prev * i%m nextArr[i-initialI] nextArr i-initialI i initialI prev * i%m self.factorials += nextArr self.factorials self factorials nextArr return self.factorials[n] self.factorials[n] self.factorials self factorials n self self n n def inv(self,n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        p = self.MOD
        pi = n%p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0]*(n+1-len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI,min(p,n+1)):
            next = -self.invModulos[p%i]*(p//i)%p
            self.invModulos.append(next)
        return self.invModulos[pi]
    
     inv if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
         n <= -1 n -1 print("Invalid argument to calculate n^(-1)") print "Invalid argument to calculate n^(-1)" print("n must be non-negative value. But the argument was " + str(n)) print "n must be non-negative value. But the argument was " + str(n) "n must be non-negative value. But the argument was " str(n) str n exit() exit p = self.MOD p self.MOD self MOD pi = n%p pi n%p n p if pi < len(self.invModulos):
            return self.invModulos[pi]
         pi < len(self.invModulos) pi len(self.invModulos) len self.invModulos self invModulos return self.invModulos[pi] self.invModulos[pi] self.invModulos self invModulos pi nextArr = [0]*(n+1-len(self.invModulos)) nextArr [0]*(n+1-len(self.invModulos)) [0] 0 n+1-len(self.invModulos) n+1 n 1 len(self.invModulos) len self.invModulos self invModulos initialI = len(self.invModulos) initialI len(self.invModulos) len self.invModulos self invModulos for i in range(initialI,min(p,n+1)):
            next = -self.invModulos[p%i]*(p//i)%p
            self.invModulos.append(next)
         i range(initialI,min(p,n+1)) range initialI min(p,n+1) min p n+1 n 1 next = -self.invModulos[p%i]*(p//i)%p next -self.invModulos[p%i]*(p//i)%p -self.invModulos[p%i]*(p//i) -self.invModulos[p%i] self.invModulos[p%i] self.invModulos self invModulos p%i p i p//i p i p self.invModulos.append(next) self.invModulos.append self.invModulos self invModulos append next return self.invModulos[pi] self.invModulos[pi] self.invModulos self invModulos pi self self n n def invFactorial(self,n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n) # To make sure already calculated n^-1
        nextArr = [0]*(n+1-len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = (prev * self.invModulos[i%p])%p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n] invFactorial if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
         n <= -1 n -1 print("Invalid argument to calculate (n^(-1))!") print "Invalid argument to calculate (n^(-1))!" print("n must be non-negative value. But the argument was " + str(n)) print "n must be non-negative value. But the argument was " + str(n) "n must be non-negative value. But the argument was " str(n) str n exit() exit if n < len(self.invFactorial_):
            return self.invFactorial_[n]
         n < len(self.invFactorial_) n len(self.invFactorial_) len self.invFactorial_ self invFactorial_ return self.invFactorial_[n] self.invFactorial_[n] self.invFactorial_ self invFactorial_ n self.inv(n) self.inv self inv n nextArr = [0]*(n+1-len(self.invFactorial_)) nextArr [0]*(n+1-len(self.invFactorial_)) [0] 0 n+1-len(self.invFactorial_) n+1 n 1 len(self.invFactorial_) len self.invFactorial_ self invFactorial_ initialI = len(self.invFactorial_) initialI len(self.invFactorial_) len self.invFactorial_ self invFactorial_ prev = self.invFactorial_[-1] prev self.invFactorial_[-1] self.invFactorial_ self invFactorial_ -1 p = self.MOD p self.MOD self MOD for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = (prev * self.invModulos[i%p])%p
         i range(initialI,n+1) range initialI n+1 n 1 prev = nextArr[i-initialI] = (prev * self.invModulos[i%p])%p prev (prev * self.invModulos[i%p])%p prev * self.invModulos[i%p] prev self.invModulos[i%p] self.invModulos self invModulos i%p i p p = nextArr[i-initialI] = (prev * self.invModulos[i%p])%p nextArr[i-initialI] nextArr i-initialI i initialI (prev * self.invModulos[i%p])%p self.invFactorial_ += nextArr self.invFactorial_ self invFactorial_ nextArr return self.invFactorial_[n] self.invFactorial_[n] self.invFactorial_ self invFactorial_ n self self n n class Combination:
    def __init__(self,MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)
    
    def choose_k_from_n(self,n,k):
        if k < 0 or n < k:
            return 0
        k = min(k,n-k)
        f = self.factorial
        return f.calc(n)*f.invFactorial(max(n-k,k))*f.invFactorial(min(k,n-k))%self.MOD Combination def __init__(self,MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)
    
     __init__ self.MOD = MOD self.MOD self MOD MOD self.factorial = Factorial(MOD) self.factorial self factorial Factorial(MOD) Factorial MOD self self MOD MOD def choose_k_from_n(self,n,k):
        if k < 0 or n < k:
            return 0
        k = min(k,n-k)
        f = self.factorial
        return f.calc(n)*f.invFactorial(max(n-k,k))*f.invFactorial(min(k,n-k))%self.MOD choose_k_from_n if k < 0 or n < k:
            return 0
         k < 0 or n < k k < 0 k 0 n < k n k return 0 0 k = min(k,n-k) k min(k,n-k) min k n-k n k f = self.factorial f self.factorial self factorial return f.calc(n)*f.invFactorial(max(n-k,k))*f.invFactorial(min(k,n-k))%self.MOD f.calc(n)*f.invFactorial(max(n-k,k))*f.invFactorial(min(k,n-k))%self.MOD f.calc(n)*f.invFactorial(max(n-k,k))*f.invFactorial(min(k,n-k)) f.calc(n)*f.invFactorial(max(n-k,k)) f.calc(n) f.calc f calc n f.invFactorial(max(n-k,k)) f.invFactorial f invFactorial max(n-k,k) max n-k n k k f.invFactorial(min(k,n-k)) f.invFactorial f invFactorial min(k,n-k) min k n-k n k self.MOD self MOD self self n n k k def solve(n: int, k: int):
    c = Combination(MOD)
    sum = 0
    for i in range(min(n,k+1)-1,-1,-1):
        c1 = c.choose_k_from_n(n,i)
        c2 = c.choose_k_from_n(n-1,i)
        sum = (sum + c1*c2)%MOD
    print(sum)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template) solve c = Combination(MOD) c Combination(MOD) Combination MOD sum = 0 sum 0 for i in range(min(n,k+1)-1,-1,-1):
        c1 = c.choose_k_from_n(n,i)
        c2 = c.choose_k_from_n(n-1,i)
        sum = (sum + c1*c2)%MOD
     i range(min(n,k+1)-1,-1,-1) range min(n,k+1)-1 min(n,k+1) min n k+1 k 1 1 -1 -1 c1 = c.choose_k_from_n(n,i) c1 c.choose_k_from_n(n,i) c.choose_k_from_n c choose_k_from_n n i c2 = c.choose_k_from_n(n-1,i) c2 c.choose_k_from_n(n-1,i) c.choose_k_from_n c choose_k_from_n n-1 n 1 i sum = (sum + c1*c2)%MOD sum (sum + c1*c2)%MOD sum + c1*c2 sum c1*c2 c1 c2 MOD print(sum) print sum return n: int n k: int k def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    solve(n, k) main def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
     iterate_tokens for line in sys.stdin:
            for word in line.split():
                yield word
     line sys.stdin sys stdin for word in line.split():
                yield word
     word line.split() line.split line split yield word word tokens = iterate_tokens() tokens iterate_tokens() iterate_tokens n = int(next(tokens)) n int(next(tokens)) int next(tokens) next tokens k = int(next(tokens)) k int(next(tokens)) int next(tokens) next tokens solve(n, k) solve n k if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def solve(n: int, k: int):
    c = Combination(MOD)
    sum = 0
    for i in range(min(n,k+1)-1,-1,-1):
        c1 = c.choose_k_from_n(n,i)
        c2 = c.choose_k_from_n(n-1,i)
        sum = (sum + c1*c2)%MOD
    print(sum)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template) def solve(n: int, k: int):
    c = Combination(MOD)
    sum = 0
    for i in range(min(n,k+1)-1,-1,-1):
        c1 = c.choose_k_from_n(n,i)
        c2 = c.choose_k_from_n(n-1,i)
        sum = (sum + c1*c2)%MOD
    print(sum)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template) solve def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    solve(n, k) def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    solve(n, k) main class Factorial:
    def __init__(self,MOD):
        self.MOD = MOD
        self.factorials = [1,1] # 階乗を求めるためのキャッシュ
        self.invModulos = [0,1] # n^-1のキャッシュ
        self.invFactorial_ = [1,1] # (n^-1)!のキャッシュ

    def calc(self,n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0]*(n+1-len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = prev * i%m
        self.factorials += nextArr
        return self.factorials[n]
    
    def inv(self,n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        p = self.MOD
        pi = n%p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0]*(n+1-len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI,min(p,n+1)):
            next = -self.invModulos[p%i]*(p//i)%p
            self.invModulos.append(next)
        return self.invModulos[pi]
    
    def invFactorial(self,n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n) # To make sure already calculated n^-1
        nextArr = [0]*(n+1-len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = (prev * self.invModulos[i%p])%p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n] class Factorial:
    def __init__(self,MOD):
        self.MOD = MOD
        self.factorials = [1,1] # 階乗を求めるためのキャッシュ
        self.invModulos = [0,1] # n^-1のキャッシュ
        self.invFactorial_ = [1,1] # (n^-1)!のキャッシュ

    def calc(self,n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0]*(n+1-len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = prev * i%m
        self.factorials += nextArr
        return self.factorials[n]
    
    def inv(self,n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        p = self.MOD
        pi = n%p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0]*(n+1-len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI,min(p,n+1)):
            next = -self.invModulos[p%i]*(p//i)%p
            self.invModulos.append(next)
        return self.invModulos[pi]
    
    def invFactorial(self,n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n) # To make sure already calculated n^-1
        nextArr = [0]*(n+1-len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = (prev * self.invModulos[i%p])%p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n] Factorial class Combination:
    def __init__(self,MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)
    
    def choose_k_from_n(self,n,k):
        if k < 0 or n < k:
            return 0
        k = min(k,n-k)
        f = self.factorial
        return f.calc(n)*f.invFactorial(max(n-k,k))*f.invFactorial(min(k,n-k))%self.MOD class Combination:
    def __init__(self,MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)
    
    def choose_k_from_n(self,n,k):
        if k < 0 or n < k:
            return 0
        k = min(k,n-k)
        f = self.factorial
        return f.calc(n)*f.invFactorial(max(n-k,k))*f.invFactorial(min(k,n-k))%self.MOD Combination MOD = 1000000007 1000000007 MOD
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

class Factorial:
    def __init__(self,MOD):
        self.MOD = MOD
        self.factorials = [1,1] # 階乗を求めるためのキャッシュ
        self.invModulos = [0,1] # n^-1のキャッシュ
        self.invFactorial_ = [1,1] # (n^-1)!のキャッシュ

    def calc(self,n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0]*(n+1-len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = prev * i%m
        self.factorials += nextArr
        return self.factorials[n]
    
    def inv(self,n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        p = self.MOD
        pi = n%p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0]*(n+1-len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI,min(p,n+1)):
            next = -self.invModulos[p%i]*(p//i)%p
            self.invModulos.append(next)
        return self.invModulos[pi]
    
    def invFactorial(self,n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit() 
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n) # To make sure already calculated n^-1
        nextArr = [0]*(n+1-len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI,n+1):
            prev = nextArr[i-initialI] = (prev * self.invModulos[i%p])%p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n]


class Combination:
    def __init__(self,MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)
    
    def choose_k_from_n(self,n,k):
        if k < 0 or n < k:
            return 0
        k = min(k,n-k)
        f = self.factorial
        return f.calc(n)*f.invFactorial(max(n-k,k))*f.invFactorial(min(k,n-k))%self.MOD


def solve(n: int, k: int):
    c = Combination(MOD)
    sum = 0
    for i in range(min(n,k+1)-1,-1,-1):
        c1 = c.choose_k_from_n(n,i)
        c2 = c.choose_k_from_n(n-1,i)
        sum = (sum + c1*c2)%MOD
    print(sum)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    k = int(next(tokens))  # type: int
    solve(n, k)

if __name__ == '__main__':
    main()
