class Factorial:
    def __init__(self,n,mod):
        self.f=f=[0]*(n+1)
        f[0]=b=1
        self.mod=mod
        for i in range(1,n+1):f[i]=b=b*i%mod
        self.inv=inv=[0]*(n+1)
        inv[n]=b=pow(self.f[n],mod-2,mod)
        for i in range(n,0,-1):inv[i-1]=b=b*i%mod
    def factorial(self,i):
        return self.f[i]
    def ifactorial(self,i):
        return self.inv[i]
    def comb(self,n,k):
        if n>=k:
            return self.f[n]*self.inv[n-k]%self.mod*self.inv[k]%self.mod
        else:
            return 0
    def homp(self,n,k):
        return self.comb(n+k-1,n-1)
M=10**9+7
n,k=map(int,input().split())
f=Factorial(n*2,M)
c=f.comb
h=f.homp
a=0
for i in range(min(k+1,n)):
    a+=c(n,i)*h(n-i,i)%M
print(a%M) class Factorial:
    def __init__(self,n,mod):
        self.f=f=[0]*(n+1)
        f[0]=b=1
        self.mod=mod
        for i in range(1,n+1):f[i]=b=b*i%mod
        self.inv=inv=[0]*(n+1)
        inv[n]=b=pow(self.f[n],mod-2,mod)
        for i in range(n,0,-1):inv[i-1]=b=b*i%mod
    def factorial(self,i):
        return self.f[i]
    def ifactorial(self,i):
        return self.inv[i]
    def comb(self,n,k):
        if n>=k:
            return self.f[n]*self.inv[n-k]%self.mod*self.inv[k]%self.mod
        else:
            return 0
    def homp(self,n,k):
        return self.comb(n+k-1,n-1) Factorial def __init__(self,n,mod):
        self.f=f=[0]*(n+1)
        f[0]=b=1
        self.mod=mod
        for i in range(1,n+1):f[i]=b=b*i%mod
        self.inv=inv=[0]*(n+1)
        inv[n]=b=pow(self.f[n],mod-2,mod)
        for i in range(n,0,-1):inv[i-1]=b=b*i%mod
     __init__ self.f=f=[0]*(n+1) self.f self f [0]*(n+1) [0] 0 n+1 n 1 =f=[0]*(n+1) f [0]*(n+1) f[0]=b=1 f[0] f 0 1 =b=1 b 1 self.mod=mod self.mod self mod mod for i in range(1,n+1):f[i]=b=b*i%mod
         i range(1,n+1) range 1 n+1 n 1 self.inv=inv=[0]*(n+1) self.inv self inv [0]*(n+1) [0] 0 n+1 n 1 =inv=[0]*(n+1) inv [0]*(n+1) inv[n]=b=pow(self.f[n],mod-2,mod) inv[n] inv n pow(self.f[n],mod-2,mod) pow self.f[n] self.f self f n mod-2 mod 2 mod =b=pow(self.f[n],mod-2,mod) b pow(self.f[n],mod-2,mod) for i in range(n,0,-1):inv[i-1]=b=b*i%mod
     i range(n,0,-1) range n 0 -1 self self n n mod mod def factorial(self,i):
        return self.f[i]
     factorial return self.f[i] self.f[i] self.f self f i self self i i def ifactorial(self,i):
        return self.inv[i]
     ifactorial return self.inv[i] self.inv[i] self.inv self inv i self self i i def comb(self,n,k):
        if n>=k:
            return self.f[n]*self.inv[n-k]%self.mod*self.inv[k]%self.mod
        else:
            return 0
     comb if n>=k:
            return self.f[n]*self.inv[n-k]%self.mod*self.inv[k]%self.mod
        else:
            return 0
     n>=k n k return self.f[n]*self.inv[n-k]%self.mod*self.inv[k]%self.mod self.f[n]*self.inv[n-k]%self.mod*self.inv[k]%self.mod self.f[n]*self.inv[n-k]%self.mod*self.inv[k] self.f[n]*self.inv[n-k]%self.mod self.f[n]*self.inv[n-k] self.f[n] self.f self f n self.inv[n-k] self.inv self inv n-k n k self.mod self mod self.inv[k] self.inv self inv k self.mod self mod return 0 0 self self n n k k def homp(self,n,k):
        return self.comb(n+k-1,n-1) homp return self.comb(n+k-1,n-1) self.comb(n+k-1,n-1) self.comb self comb n+k-1 n+k n k 1 n-1 n 1 self self n n k k M=10**9+7 M 10**9+7 10**9 10 9 7 n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k f=Factorial(n*2,M) f Factorial(n*2,M) Factorial n*2 n 2 M c=f.comb c f.comb f comb h=f.homp h f.homp f homp a=0 a 0 for i in range(min(k+1,n)):
    a+=c(n,i)*h(n-i,i)%M i range(min(k+1,n)) range min(k+1,n) min k+1 k 1 n a+=c(n,i)*h(n-i,i)%M a c(n,i)*h(n-i,i)%M c(n,i)*h(n-i,i) c(n,i) c n i h(n-i,i) h n-i n i i M print(a%M) print a%M a M a+=c(n,i)*h(n-i,i)%M c(n,i)*h(n-i,i)%M a f=Factorial(n*2,M) Factorial(n*2,M) f n,k=map(int,input().split()) map(int,input().split()) n M=10**9+7 10**9+7 M h=f.homp f.homp h a=0 0 a class Factorial:
    def __init__(self,n,mod):
        self.f=f=[0]*(n+1)
        f[0]=b=1
        self.mod=mod
        for i in range(1,n+1):f[i]=b=b*i%mod
        self.inv=inv=[0]*(n+1)
        inv[n]=b=pow(self.f[n],mod-2,mod)
        for i in range(n,0,-1):inv[i-1]=b=b*i%mod
    def factorial(self,i):
        return self.f[i]
    def ifactorial(self,i):
        return self.inv[i]
    def comb(self,n,k):
        if n>=k:
            return self.f[n]*self.inv[n-k]%self.mod*self.inv[k]%self.mod
        else:
            return 0
    def homp(self,n,k):
        return self.comb(n+k-1,n-1) class Factorial:
    def __init__(self,n,mod):
        self.f=f=[0]*(n+1)
        f[0]=b=1
        self.mod=mod
        for i in range(1,n+1):f[i]=b=b*i%mod
        self.inv=inv=[0]*(n+1)
        inv[n]=b=pow(self.f[n],mod-2,mod)
        for i in range(n,0,-1):inv[i-1]=b=b*i%mod
    def factorial(self,i):
        return self.f[i]
    def ifactorial(self,i):
        return self.inv[i]
    def comb(self,n,k):
        if n>=k:
            return self.f[n]*self.inv[n-k]%self.mod*self.inv[k]%self.mod
        else:
            return 0
    def homp(self,n,k):
        return self.comb(n+k-1,n-1) Factorial k=map(int,input().split()) map(int,input().split()) k c=f.comb f.comb c
class Factorial:
    def __init__(self,n,mod):
        self.f=f=[0]*(n+1)
        f[0]=b=1
        self.mod=mod
        for i in range(1,n+1):f[i]=b=b*i%mod
        self.inv=inv=[0]*(n+1)
        inv[n]=b=pow(self.f[n],mod-2,mod)
        for i in range(n,0,-1):inv[i-1]=b=b*i%mod
    def factorial(self,i):
        return self.f[i]
    def ifactorial(self,i):
        return self.inv[i]
    def comb(self,n,k):
        if n>=k:
            return self.f[n]*self.inv[n-k]%self.mod*self.inv[k]%self.mod
        else:
            return 0
    def homp(self,n,k):
        return self.comb(n+k-1,n-1)
M=10**9+7
n,k=map(int,input().split())
f=Factorial(n*2,M)
c=f.comb
h=f.homp
a=0
for i in range(min(k+1,n)):
    a+=c(n,i)*h(n-i,i)%M
print(a%M)