n,k=map(int,input().split())
mod=10**9+7
U = 4*10**5+1
MOD = 10**9+7

fact = [1]*(U+1)
fact_inv = [1]*(U+1)

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

for i in range(U,0,-1):
	fact_inv[i-1] = (fact_inv[i]*i)%MOD

def comb(n,k):
  if k < 0 or k > n:
    return 0
  x = fact[n]
  x *= fact_inv[k]
  x %= MOD
  x *= fact_inv[n-k]
  x %= MOD
  return x

if n-1<=k:
    print(comb(2*n-1,n-1))
else:
    ans=0
    for i in range(1+k):
        ans+=comb(n,i)*comb(n-1,n-i-1)
        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 U = 4*10**5+1 U 4*10**5+1 4*10**5 4 10**5 10 5 1 MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 fact = [1]*(U+1) fact [1]*(U+1) [1] 1 U+1 U 1 fact_inv = [1]*(U+1) fact_inv [1]*(U+1) [1] 1 U+1 U 1 for i in range(1,U+1):
  fact[i] = (fact[i-1]*i)%MOD i range(1,U+1) range 1 U+1 U 1 fact[i] = (fact[i-1]*i)%MOD fact[i] fact i (fact[i-1]*i)%MOD fact[i-1]*i fact[i-1] fact i-1 i 1 i MOD fact_inv[U] = pow(fact[U],MOD-2,MOD) fact_inv[U] fact_inv U pow(fact[U],MOD-2,MOD) pow fact[U] fact U MOD-2 MOD 2 MOD for i in range(U,0,-1):
	fact_inv[i-1] = (fact_inv[i]*i)%MOD i range(U,0,-1) range U 0 -1 fact_inv[i-1] = (fact_inv[i]*i)%MOD fact_inv[i-1] fact_inv i-1 i 1 (fact_inv[i]*i)%MOD fact_inv[i]*i fact_inv[i] fact_inv i i MOD def comb(n,k):
  if k < 0 or k > n:
    return 0
  x = fact[n]
  x *= fact_inv[k]
  x %= MOD
  x *= fact_inv[n-k]
  x %= MOD
  return x comb if k < 0 or k > n:
    return 0
   k < 0 or k > n k < 0 k 0 k > n k n return 0 0 x = fact[n] x fact[n] fact n x *= fact_inv[k] x fact_inv[k] fact_inv k x %= MOD x MOD x *= fact_inv[n-k] x fact_inv[n-k] fact_inv n-k n k x %= MOD x MOD return x x n n k k if n-1<=k:
    print(comb(2*n-1,n-1))
else:
    ans=0
    for i in range(1+k):
        ans+=comb(n,i)*comb(n-1,n-i-1)
        ans%=mod
    print(ans) n-1<=k n-1 n 1 k print(comb(2*n-1,n-1)) print comb(2*n-1,n-1) comb 2*n-1 2*n 2 n 1 n-1 n 1 ans=0 ans 0 for i in range(1+k):
        ans+=comb(n,i)*comb(n-1,n-i-1)
        ans%=mod
     i range(1+k) range 1+k 1 k ans+=comb(n,i)*comb(n-1,n-i-1) ans comb(n,i)*comb(n-1,n-i-1) comb(n,i) comb n i comb(n-1,n-i-1) comb n-1 n 1 n-i-1 n-i n i 1 ans%=mod ans mod print(ans) print ans mod=10**9+7 10**9+7 mod n,k=map(int,input().split()) map(int,input().split()) n U = 4*10**5+1 4*10**5+1 U def comb(n,k):
  if k < 0 or k > n:
    return 0
  x = fact[n]
  x *= fact_inv[k]
  x %= MOD
  x *= fact_inv[n-k]
  x %= MOD
  return x def comb(n,k):
  if k < 0 or k > n:
    return 0
  x = fact[n]
  x *= fact_inv[k]
  x %= MOD
  x *= fact_inv[n-k]
  x %= MOD
  return x comb ans+=comb(n,i)*comb(n-1,n-i-1) comb(n,i)*comb(n-1,n-i-1) ans ans=0 0 ans MOD = 10**9+7 10**9+7 MOD fact_inv = [1]*(U+1) [1]*(U+1) fact_inv ans%=mod mod ans k=map(int,input().split()) map(int,input().split()) k fact = [1]*(U+1) [1]*(U+1) fact
n,k=map(int,input().split())
mod=10**9+7
U = 4*10**5+1
MOD = 10**9+7

fact = [1]*(U+1)
fact_inv = [1]*(U+1)

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

for i in range(U,0,-1):
	fact_inv[i-1] = (fact_inv[i]*i)%MOD

def comb(n,k):
  if k < 0 or k > n:
    return 0
  x = fact[n]
  x *= fact_inv[k]
  x %= MOD
  x *= fact_inv[n-k]
  x %= MOD
  return x

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


