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

MAX_N=10**6
fact=[1]
fact_inv=[0]*(MAX_N+4)
for i in range(MAX_N+3):
  fact.append(fact[-1]*(i+1)%mod)

fact_inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(MAX_N+2,-1,-1):
  fact_inv[i]=fact_inv[i+1]*(i+1)%mod

def f(n,k,mod):
  return fact[n]*fact_inv[k]%mod*fact_inv[n-k] %mod

ans=0
#0人の部屋はmaxいくつできるか
a=min(k,n-1)
ans=0
for i in range(a+1):
  d=f(n,i,mod)*f(n-1,i,mod)
  #print(i,d)
  ans+=d%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 MAX_N=10**6 MAX_N 10**6 10 6 fact=[1] fact [1] 1 fact_inv=[0]*(MAX_N+4) fact_inv [0]*(MAX_N+4) [0] 0 MAX_N+4 MAX_N 4 for i in range(MAX_N+3):
  fact.append(fact[-1]*(i+1)%mod) i range(MAX_N+3) range MAX_N+3 MAX_N 3 fact.append(fact[-1]*(i+1)%mod) fact.append fact append fact[-1]*(i+1)%mod fact[-1]*(i+1) fact[-1] fact -1 i+1 i 1 mod fact_inv[-1]=pow(fact[-1],mod-2,mod) fact_inv[-1] fact_inv -1 pow(fact[-1],mod-2,mod) pow fact[-1] fact -1 mod-2 mod 2 mod for i in range(MAX_N+2,-1,-1):
  fact_inv[i]=fact_inv[i+1]*(i+1)%mod i range(MAX_N+2,-1,-1) range MAX_N+2 MAX_N 2 -1 -1 fact_inv[i]=fact_inv[i+1]*(i+1)%mod fact_inv[i] fact_inv i fact_inv[i+1]*(i+1)%mod fact_inv[i+1]*(i+1) fact_inv[i+1] fact_inv i+1 i 1 i+1 i 1 mod def f(n,k,mod):
  return fact[n]*fact_inv[k]%mod*fact_inv[n-k] %mod f return fact[n]*fact_inv[k]%mod*fact_inv[n-k] %mod fact[n]*fact_inv[k]%mod*fact_inv[n-k] %mod fact[n]*fact_inv[k]%mod*fact_inv[n-k] fact[n]*fact_inv[k]%mod fact[n]*fact_inv[k] fact[n] fact n fact_inv[k] fact_inv k mod fact_inv[n-k] fact_inv n-k n k mod n n k k mod mod ans=0 ans 0 a=min(k,n-1) a min(k,n-1) min k n-1 n 1 ans=0 ans 0 for i in range(a+1):
  d=f(n,i,mod)*f(n-1,i,mod)
  #print(i,d)
  ans+=d%mod
  ans%=mod i range(a+1) range a+1 a 1 d=f(n,i,mod)*f(n-1,i,mod) d f(n,i,mod)*f(n-1,i,mod) f(n,i,mod) f n i mod f(n-1,i,mod) f n-1 n 1 i mod ans+=d%mod ans d%mod d mod ans%=mod ans mod print(ans) print ans ans=0 0 ans n,k=map(int,input().split()) map(int,input().split()) n MAX_N=10**6 10**6 MAX_N a=min(k,n-1) min(k,n-1) a mod=10**9+7 10**9+7 mod k=map(int,input().split()) map(int,input().split()) k d=f(n,i,mod)*f(n-1,i,mod) f(n,i,mod)*f(n-1,i,mod) d def f(n,k,mod):
  return fact[n]*fact_inv[k]%mod*fact_inv[n-k] %mod def f(n,k,mod):
  return fact[n]*fact_inv[k]%mod*fact_inv[n-k] %mod f ans+=d%mod d%mod ans fact=[1] [1] fact ans=0 0 ans fact_inv=[0]*(MAX_N+4) [0]*(MAX_N+4) fact_inv ans%=mod mod ans
n,k=map(int,input().split())
mod=10**9+7

MAX_N=10**6
fact=[1]
fact_inv=[0]*(MAX_N+4)
for i in range(MAX_N+3):
  fact.append(fact[-1]*(i+1)%mod)

fact_inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(MAX_N+2,-1,-1):
  fact_inv[i]=fact_inv[i+1]*(i+1)%mod

def f(n,k,mod):
  return fact[n]*fact_inv[k]%mod*fact_inv[n-k] %mod

ans=0
#0人の部屋はmaxいくつできるか
a=min(k,n-1)
ans=0
for i in range(a+1):
  d=f(n,i,mod)*f(n-1,i,mod)
  #print(i,d)
  ans+=d%mod
  ans%=mod

print(ans)