n,k=map(int,input().split())
mod=10**9+7

#n!とその逆元を求めておく
N=4*10**5+10
g1=[1,1] #n!
g2=[1,1] #n!の逆元
inverse=[0,1]
for i in range(2,N+1):
    g1.append((g1[-1]*i)%mod)
    inverse.append((-inverse[mod%i]*(mod//i))%mod)
    g2.append((g2[-1]*inverse[-1])%mod)

def cmb(n,r): #nCrを求める
    if (r<0 or r>n):
        return 0
    r=min(r,n-r)
    return g1[n]*g2[r]*g2[n-r]%mod

if n<=k-1:
    print(cmb(2*n-1,n))
else:
    ans=0
    for a in range(k+1):
        ans+=cmb(n,a)*cmb(n-1,a)%mod
        ans%=mod
    print(ans) n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k mod=10**9+7 mod 10**9+7 10**9 10 9 7 N=4*10**5+10 N 4*10**5+10 4*10**5 4 10**5 10 5 10 g1=[1,1] g1 [1,1] 1 1 g2=[1,1] g2 [1,1] 1 1 inverse=[0,1] inverse [0,1] 0 1 for i in range(2,N+1):
    g1.append((g1[-1]*i)%mod)
    inverse.append((-inverse[mod%i]*(mod//i))%mod)
    g2.append((g2[-1]*inverse[-1])%mod) i range(2,N+1) range 2 N+1 N 1 g1.append((g1[-1]*i)%mod) g1.append g1 append (g1[-1]*i)%mod g1[-1]*i g1[-1] g1 -1 i mod inverse.append((-inverse[mod%i]*(mod//i))%mod) inverse.append inverse append (-inverse[mod%i]*(mod//i))%mod -inverse[mod%i]*(mod//i) -inverse[mod%i] inverse[mod%i] inverse mod%i mod i mod//i mod i mod g2.append((g2[-1]*inverse[-1])%mod) g2.append g2 append (g2[-1]*inverse[-1])%mod g2[-1]*inverse[-1] g2[-1] g2 -1 inverse[-1] inverse -1 mod def cmb(n,r): #nCrを求める
    if (r<0 or r>n):
        return 0
    r=min(r,n-r)
    return g1[n]*g2[r]*g2[n-r]%mod cmb if (r<0 or r>n):
        return 0
     r<0 or r>n r<0 r 0 r>n r n return 0 0 r=min(r,n-r) r min(r,n-r) min r n-r n r return g1[n]*g2[r]*g2[n-r]%mod g1[n]*g2[r]*g2[n-r]%mod g1[n]*g2[r]*g2[n-r] g1[n]*g2[r] g1[n] g1 n g2[r] g2 r g2[n-r] g2 n-r n r mod n n r r if n<=k-1:
    print(cmb(2*n-1,n))
else:
    ans=0
    for a in range(k+1):
        ans+=cmb(n,a)*cmb(n-1,a)%mod
        ans%=mod
    print(ans) n<=k-1 n k-1 k 1 print(cmb(2*n-1,n)) print cmb(2*n-1,n) cmb 2*n-1 2*n 2 n 1 n ans=0 ans 0 for a in range(k+1):
        ans+=cmb(n,a)*cmb(n-1,a)%mod
        ans%=mod
     a range(k+1) range k+1 k 1 ans+=cmb(n,a)*cmb(n-1,a)%mod ans cmb(n,a)*cmb(n-1,a)%mod cmb(n,a)*cmb(n-1,a) cmb(n,a) cmb n a cmb(n-1,a) cmb n-1 n 1 a mod ans%=mod ans mod print(ans) print ans inverse=[0,1] [0,1] inverse n,k=map(int,input().split()) map(int,input().split()) n mod=10**9+7 10**9+7 mod g1=[1,1] [1,1] g1 def cmb(n,r): #nCrを求める
    if (r<0 or r>n):
        return 0
    r=min(r,n-r)
    return g1[n]*g2[r]*g2[n-r]%mod def cmb(n,r): #nCrを求める
    if (r<0 or r>n):
        return 0
    r=min(r,n-r)
    return g1[n]*g2[r]*g2[n-r]%mod cmb k=map(int,input().split()) map(int,input().split()) k ans=0 0 ans g2=[1,1] [1,1] g2 ans+=cmb(n,a)*cmb(n-1,a)%mod cmb(n,a)*cmb(n-1,a)%mod ans ans%=mod mod ans N=4*10**5+10 4*10**5+10 N
n,k=map(int,input().split())
mod=10**9+7

#n!とその逆元を求めておく
N=4*10**5+10
g1=[1,1] #n!
g2=[1,1] #n!の逆元
inverse=[0,1]
for i in range(2,N+1):
    g1.append((g1[-1]*i)%mod)
    inverse.append((-inverse[mod%i]*(mod//i))%mod)
    g2.append((g2[-1]*inverse[-1])%mod)

def cmb(n,r): #nCrを求める
    if (r<0 or r>n):
        return 0
    r=min(r,n-r)
    return g1[n]*g2[r]*g2[n-r]%mod

if n<=k-1:
    print(cmb(2*n-1,n))
else:
    ans=0
    for a in range(k+1):
        ans+=cmb(n,a)*cmb(n-1,a)%mod
        ans%=mod
    print(ans)