MOD=10**9+7
class Fp(int):
    def __new__(self,x=0):return super().__new__(self,x%MOD)
    def inv(self):return self.__class__(super().__pow__(MOD-2,MOD))
    def __add__(self,value):return self.__class__(super().__add__(value))
    def __sub__(self,value):return self.__class__(super().__sub__(value))
    def __mul__(self,value):return self.__class__(super().__mul__(value))
    def __floordiv__(self,value):return self.__class__(self*self.__class__(value).inv())
    def __pow__(self,value):return self.__class__(super().__pow__(value%(MOD-1), MOD))
    __radd__=__add__
    __rmul__=__mul__
    def __rsub__(self,value):return self.__class__(-super().__sub__(value))
    def __rfloordiv__(self,value):return self.__class__(self.inv()*value)
    def __iadd__(self,value):self=self+value;return self
    def __isub__(self,value):self=self-value;return self
    def __imul__(self,value):self=self*value;return self
    def __ifloordiv__(self,value):self=self //value;return self
    def __ipow__(self,value):self=self**value;return self
    def __neg__(self):return self.__class__(super().__neg__())

class Combination:
    def __init__(self,max_n):
        self.max_n=0
        self.fact=[Fp(1)]
        self.ifact=[Fp(1)]
        self.make_fact_list(max_n)
    def C(self,n,k):return self.fact[n]*self.ifact[k]*self.ifact[n-k] if 0<=k<=n else 0
    def H(self,n,k):return self.C(n+k-1,k) if n or k else 1
    def P(self,n,k):return self.fact[n]*self.ifact[n-k] if 0<=k<=n else 0
    def make_fact_list(self,max_n):
        if max_n<=self.max_n: return
        self.fact+=[Fp(0)]*(max_n-self.max_n)
        self.ifact+=[Fp(0)]*(max_n-self.max_n)
        for i in range(self.max_n+1,max_n+1):
            self.fact[i]=self.fact[i-1]*i
            self.ifact[i]=self.ifact[i-1]//i
        self.max_n=max_n

N,K=map(int, input().split())
K=min(N-1,K)
C=Combination(N*2)
ans=Fp(1)
for i in range(1,K+1):
    ans+=C.C(N,i)*C.H(N-i,i)
print(ans) MOD=10**9+7 MOD 10**9+7 10**9 10 9 7 class Fp(int):
    def __new__(self,x=0):return super().__new__(self,x%MOD)
    def inv(self):return self.__class__(super().__pow__(MOD-2,MOD))
    def __add__(self,value):return self.__class__(super().__add__(value))
    def __sub__(self,value):return self.__class__(super().__sub__(value))
    def __mul__(self,value):return self.__class__(super().__mul__(value))
    def __floordiv__(self,value):return self.__class__(self*self.__class__(value).inv())
    def __pow__(self,value):return self.__class__(super().__pow__(value%(MOD-1), MOD))
    __radd__=__add__
    __rmul__=__mul__
    def __rsub__(self,value):return self.__class__(-super().__sub__(value))
    def __rfloordiv__(self,value):return self.__class__(self.inv()*value)
    def __iadd__(self,value):self=self+value;return self
    def __isub__(self,value):self=self-value;return self
    def __imul__(self,value):self=self*value;return self
    def __ifloordiv__(self,value):self=self //value;return self
    def __ipow__(self,value):self=self**value;return self
    def __neg__(self):return self.__class__(super().__neg__()) Fp def __new__(self,x=0):return super().__new__(self,x%MOD)
     __new__ self self x=0 x 0 def inv(self):return self.__class__(super().__pow__(MOD-2,MOD))
     inv self self def __add__(self,value):return self.__class__(super().__add__(value))
     __add__ self self value value def __sub__(self,value):return self.__class__(super().__sub__(value))
     __sub__ self self value value def __mul__(self,value):return self.__class__(super().__mul__(value))
     __mul__ self self value value def __floordiv__(self,value):return self.__class__(self*self.__class__(value).inv())
     __floordiv__ self self value value def __pow__(self,value):return self.__class__(super().__pow__(value%(MOD-1), MOD))
     __pow__ self self value value __radd__=__add__ __radd__ __add__ __rmul__=__mul__ __rmul__ __mul__ def __rsub__(self,value):return self.__class__(-super().__sub__(value))
     __rsub__ self self value value def __rfloordiv__(self,value):return self.__class__(self.inv()*value)
     __rfloordiv__ self self value value def __iadd__(self,value):self=self+value;return self
     __iadd__ self self value value def __isub__(self,value):self=self-value;return self
     __isub__ self self value value def __imul__(self,value):self=self*value;return self
     __imul__ self self value value def __ifloordiv__(self,value):self=self //value;return self
     __ifloordiv__ self self value value def __ipow__(self,value):self=self**value;return self
     __ipow__ self self value value def __neg__(self):return self.__class__(super().__neg_ __neg__ self self int class Combination:
    def __init__(self,max_n):
        self.max_n=0
        self.fact=[Fp(1)]
        self.ifact=[Fp(1)]
        self.make_fact_list(max_n)
    def C(self,n,k):return self.fact[n]*self.ifact[k]*self.ifact[n-k] if 0<=k<=n else 0
    def H(self,n,k):return self.C(n+k-1,k) if n or k else 1
    def P(self,n,k):return self.fact[n]*self.ifact[n-k] if 0<=k<=n else 0
    def make_fact_list(self,max_n):
        if max_n<=self.max_n: return
        self.fact+=[Fp(0)]*(max_n-self.max_n)
        self.ifact+=[Fp(0)]*(max_n-self.max_n)
        for i in range(self.max_n+1,max_n+1):
            self.fact[i]=self.fact[i-1]*i
            self.ifact[i]=self.ifact[i-1]//i
        self.max_n=max_n Combination def __init__(self,max_n):
        self.max_n=0
        self.fact=[Fp(1)]
        self.ifact=[Fp(1)]
        self.make_fact_list(max_n)
     __init__ self.max_n=0 self.max_n self max_n 0 self.fact=[Fp(1)] self.fact self fact [Fp(1)] Fp(1) Fp 1 self.ifact=[Fp(1)] self.ifact self ifact [Fp(1)] Fp(1) Fp 1 self.make_fact_list(max_n) self.make_fact_list self make_fact_list max_n self self max_n max_n def C(self,n,k):return self.fact[n]*self.ifact[k]*self.ifact[n-k] if 0<=k<=n else 0
     C self self n n k k def H(self,n,k):return self.C(n+k-1,k) if n or k else 1
     H self self n n k k def P(self,n,k):return self.fact[n]*self.ifact[n-k] if 0<=k<=n else 0
     P self self n n k k def make_fact_list(self,max_n):
        if max_n<=self.max_n: return
        self.fact+=[Fp(0)]*(max_n-self.max_n)
        self.ifact+=[Fp(0)]*(max_n-self.max_n)
        for i in range(self.max_n+1,max_n+1):
            self.fact[i]=self.fact[i-1]*i
            self.ifact[i]=self.ifact[i-1]//i
        self.max_n=max_n make_fact_list if max_n<=self.max_n: return
         max_n<=self.max_n max_n self.max_n self max_n self.fact+=[Fp(0)]*(max_n-self.max_n) self.fact self fact [Fp(0)]*(max_n-self.max_n) [Fp(0)] Fp(0) Fp 0 max_n-self.max_n max_n self.max_n self max_n self.ifact+=[Fp(0)]*(max_n-self.max_n) self.ifact self ifact [Fp(0)]*(max_n-self.max_n) [Fp(0)] Fp(0) Fp 0 max_n-self.max_n max_n self.max_n self max_n for i in range(self.max_n+1,max_n+1):
            self.fact[i]=self.fact[i-1]*i
            self.ifact[i]=self.ifact[i-1]//i
         i range(self.max_n+1,max_n+1) range self.max_n+1 self.max_n self max_n 1 max_n+1 max_n 1 self.fact[i]=self.fact[i-1]*i self.fact[i] self.fact self fact i self.fact[i-1]*i self.fact[i-1] self.fact self fact i-1 i 1 i self.ifact[i]=self.ifact[i-1]//i self.ifact[i] self.ifact self ifact i self.ifact[i-1]//i self.ifact[i-1] self.ifact self ifact i-1 i 1 i self.max_n=max_n self.max_n self max_n max_n self self max_n max_n N,K=map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K K=min(N-1,K) K min(N-1,K) min N-1 N 1 K C=Combination(N*2) C Combination(N*2) Combination N*2 N 2 ans=Fp(1) ans Fp(1) Fp 1 for i in range(1,K+1):
    ans+=C.C(N,i)*C.H(N-i,i) i range(1,K+1) range 1 K+1 K 1 ans+=C.C(N,i)*C.H(N-i,i) ans C.C(N,i)*C.H(N-i,i) C.C(N,i) C.C C C N i C.H(N-i,i) C.H C H N-i N i i print(ans) print ans MOD=10**9+7 10**9+7 MOD K=min(N-1,K) min(N-1,K) K N,K=map(int, input().split()) map(int, input().split()) N C=Combination(N*2) Combination(N*2) C ans=Fp(1) Fp(1) ans K=map(int, input().split()) map(int, input().split()) K class Fp(int):
    def __new__(self,x=0):return super().__new__(self,x%MOD)
    def inv(self):return self.__class__(super().__pow__(MOD-2,MOD))
    def __add__(self,value):return self.__class__(super().__add__(value))
    def __sub__(self,value):return self.__class__(super().__sub__(value))
    def __mul__(self,value):return self.__class__(super().__mul__(value))
    def __floordiv__(self,value):return self.__class__(self*self.__class__(value).inv())
    def __pow__(self,value):return self.__class__(super().__pow__(value%(MOD-1), MOD))
    __radd__=__add__
    __rmul__=__mul__
    def __rsub__(self,value):return self.__class__(-super().__sub__(value))
    def __rfloordiv__(self,value):return self.__class__(self.inv()*value)
    def __iadd__(self,value):self=self+value;return self
    def __isub__(self,value):self=self-value;return self
    def __imul__(self,value):self=self*value;return self
    def __ifloordiv__(self,value):self=self //value;return self
    def __ipow__(self,value):self=self**value;return self
    def __neg__(self):return self.__class__(super().__neg__()) class Fp(int):
    def __new__(self,x=0):return super().__new__(self,x%MOD)
    def inv(self):return self.__class__(super().__pow__(MOD-2,MOD))
    def __add__(self,value):return self.__class__(super().__add__(value))
    def __sub__(self,value):return self.__class__(super().__sub__(value))
    def __mul__(self,value):return self.__class__(super().__mul__(value))
    def __floordiv__(self,value):return self.__class__(self*self.__class__(value).inv())
    def __pow__(self,value):return self.__class__(super().__pow__(value%(MOD-1), MOD))
    __radd__=__add__
    __rmul__=__mul__
    def __rsub__(self,value):return self.__class__(-super().__sub__(value))
    def __rfloordiv__(self,value):return self.__class__(self.inv()*value)
    def __iadd__(self,value):self=self+value;return self
    def __isub__(self,value):self=self-value;return self
    def __imul__(self,value):self=self*value;return self
    def __ifloordiv__(self,value):self=self //value;return self
    def __ipow__(self,value):self=self**value;return self
    def __neg__(self):return self.__class__(super().__neg__()) Fp ans+=C.C(N,i)*C.H(N-i,i) C.C(N,i)*C.H(N-i,i) ans class Combination:
    def __init__(self,max_n):
        self.max_n=0
        self.fact=[Fp(1)]
        self.ifact=[Fp(1)]
        self.make_fact_list(max_n)
    def C(self,n,k):return self.fact[n]*self.ifact[k]*self.ifact[n-k] if 0<=k<=n else 0
    def H(self,n,k):return self.C(n+k-1,k) if n or k else 1
    def P(self,n,k):return self.fact[n]*self.ifact[n-k] if 0<=k<=n else 0
    def make_fact_list(self,max_n):
        if max_n<=self.max_n: return
        self.fact+=[Fp(0)]*(max_n-self.max_n)
        self.ifact+=[Fp(0)]*(max_n-self.max_n)
        for i in range(self.max_n+1,max_n+1):
            self.fact[i]=self.fact[i-1]*i
            self.ifact[i]=self.ifact[i-1]//i
        self.max_n=max_n class Combination:
    def __init__(self,max_n):
        self.max_n=0
        self.fact=[Fp(1)]
        self.ifact=[Fp(1)]
        self.make_fact_list(max_n)
    def C(self,n,k):return self.fact[n]*self.ifact[k]*self.ifact[n-k] if 0<=k<=n else 0
    def H(self,n,k):return self.C(n+k-1,k) if n or k else 1
    def P(self,n,k):return self.fact[n]*self.ifact[n-k] if 0<=k<=n else 0
    def make_fact_list(self,max_n):
        if max_n<=self.max_n: return
        self.fact+=[Fp(0)]*(max_n-self.max_n)
        self.ifact+=[Fp(0)]*(max_n-self.max_n)
        for i in range(self.max_n+1,max_n+1):
            self.fact[i]=self.fact[i-1]*i
            self.ifact[i]=self.ifact[i-1]//i
        self.max_n=max_n Combination
MOD=10**9+7
class Fp(int):
    def __new__(self,x=0):return super().__new__(self,x%MOD)
    def inv(self):return self.__class__(super().__pow__(MOD-2,MOD))
    def __add__(self,value):return self.__class__(super().__add__(value))
    def __sub__(self,value):return self.__class__(super().__sub__(value))
    def __mul__(self,value):return self.__class__(super().__mul__(value))
    def __floordiv__(self,value):return self.__class__(self*self.__class__(value).inv())
    def __pow__(self,value):return self.__class__(super().__pow__(value%(MOD-1), MOD))
    __radd__=__add__
    __rmul__=__mul__
    def __rsub__(self,value):return self.__class__(-super().__sub__(value))
    def __rfloordiv__(self,value):return self.__class__(self.inv()*value)
    def __iadd__(self,value):self=self+value;return self
    def __isub__(self,value):self=self-value;return self
    def __imul__(self,value):self=self*value;return self
    def __ifloordiv__(self,value):self=self //value;return self
    def __ipow__(self,value):self=self**value;return self
    def __neg__(self):return self.__class__(super().__neg__())

class Combination:
    def __init__(self,max_n):
        self.max_n=0
        self.fact=[Fp(1)]
        self.ifact=[Fp(1)]
        self.make_fact_list(max_n)
    def C(self,n,k):return self.fact[n]*self.ifact[k]*self.ifact[n-k] if 0<=k<=n else 0
    def H(self,n,k):return self.C(n+k-1,k) if n or k else 1
    def P(self,n,k):return self.fact[n]*self.ifact[n-k] if 0<=k<=n else 0
    def make_fact_list(self,max_n):
        if max_n<=self.max_n: return
        self.fact+=[Fp(0)]*(max_n-self.max_n)
        self.ifact+=[Fp(0)]*(max_n-self.max_n)
        for i in range(self.max_n+1,max_n+1):
            self.fact[i]=self.fact[i-1]*i
            self.ifact[i]=self.ifact[i-1]//i
        self.max_n=max_n

N,K=map(int, input().split())
K=min(N-1,K)
C=Combination(N*2)
ans=Fp(1)
for i in range(1,K+1):
    ans+=C.C(N,i)*C.H(N-i,i)
print(ans)