mod_val = 10**9+7
n, k = map(int, input().split())
factorials = [1]*(n+1)  # values 0 to n
for i in range(2, n+1):
  factorials[i] = (factorials[i-1]*i)%mod_val
def mod_binomial(a, b):
  numerator = factorials[a]
  denominator = (factorials[b]*factorials[a-b])%mod_val
  invert = pow(denominator, mod_val-2, mod_val)
  return (numerator*invert)%mod_val
partial = 0
# m is number of rooms with no people
for m in range(min(k+1, n)):
  # m places within n to place the 'no people' rooms
  # put n-(n-m) people in n-m rooms (n-m) must be placed to be non-empty
  partial = (partial + (mod_binomial(n, m) * mod_binomial(n-1, m))%mod_val)%mod_val
print(partial) mod_val = 10**9+7 mod_val 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 factorials = [1]*(n+1) factorials [1]*(n+1) [1] 1 n+1 n 1 for i in range(2, n+1):
  factorials[i] = (factorials[i-1]*i)%mod_val i range(2, n+1) range 2 n+1 n 1 factorials[i] = (factorials[i-1]*i)%mod_val factorials[i] factorials i (factorials[i-1]*i)%mod_val factorials[i-1]*i factorials[i-1] factorials i-1 i 1 i mod_val def mod_binomial(a, b):
  numerator = factorials[a]
  denominator = (factorials[b]*factorials[a-b])%mod_val
  invert = pow(denominator, mod_val-2, mod_val)
  return (numerator*invert)%mod_val mod_binomial numerator = factorials[a] numerator factorials[a] factorials a denominator = (factorials[b]*factorials[a-b])%mod_val denominator (factorials[b]*factorials[a-b])%mod_val factorials[b]*factorials[a-b] factorials[b] factorials b factorials[a-b] factorials a-b a b mod_val invert = pow(denominator, mod_val-2, mod_val) invert pow(denominator, mod_val-2, mod_val) pow denominator mod_val-2 mod_val 2 mod_val return (numerator*invert)%mod_val (numerator*invert)%mod_val numerator*invert numerator invert mod_val a a b b partial = 0 partial 0 for m in range(min(k+1, n)):
  # m places within n to place the 'no people' rooms
  # put n-(n-m) people in n-m rooms (n-m) must be placed to be non-empty
  partial = (partial + (mod_binomial(n, m) * mod_binomial(n-1, m))%mod_val)%mod_val m range(min(k+1, n)) range min(k+1, n) min k+1 k 1 n partial = (partial + (mod_binomial(n, m) * mod_binomial(n-1, m))%mod_val)%mod_val partial (partial + (mod_binomial(n, m) * mod_binomial(n-1, m))%mod_val)%mod_val partial + (mod_binomial(n, m) * mod_binomial(n-1, m))%mod_val partial (mod_binomial(n, m) * mod_binomial(n-1, m))%mod_val mod_binomial(n, m) * mod_binomial(n-1, m) mod_binomial(n, m) mod_binomial n m mod_binomial(n-1, m) mod_binomial n-1 n 1 m mod_val mod_val print(partial) print partial partial = (partial + (mod_binomial(n, m) * mod_binomial(n-1, m))%mod_val)%mod_val (partial + (mod_binomial(n, m) * mod_binomial(n-1, m))%mod_val)%mod_val partial mod_val = 10**9+7 10**9+7 mod_val n, k = map(int, input().split()) map(int, input().split()) n factorials = [1]*(n+1) [1]*(n+1) factorials def mod_binomial(a, b):
  numerator = factorials[a]
  denominator = (factorials[b]*factorials[a-b])%mod_val
  invert = pow(denominator, mod_val-2, mod_val)
  return (numerator*invert)%mod_val def mod_binomial(a, b):
  numerator = factorials[a]
  denominator = (factorials[b]*factorials[a-b])%mod_val
  invert = pow(denominator, mod_val-2, mod_val)
  return (numerator*invert)%mod_val mod_binomial partial = 0 0 partial k = map(int, input().split()) map(int, input().split()) k
mod_val = 10**9+7
n, k = map(int, input().split())
factorials = [1]*(n+1)  # values 0 to n
for i in range(2, n+1):
  factorials[i] = (factorials[i-1]*i)%mod_val
def mod_binomial(a, b):
  numerator = factorials[a]
  denominator = (factorials[b]*factorials[a-b])%mod_val
  invert = pow(denominator, mod_val-2, mod_val)
  return (numerator*invert)%mod_val
partial = 0
# m is number of rooms with no people
for m in range(min(k+1, n)):
  # m places within n to place the 'no people' rooms
  # put n-(n-m) people in n-m rooms (n-m) must be placed to be non-empty
  partial = (partial + (mod_binomial(n, m) * mod_binomial(n-1, m))%mod_val)%mod_val
print(partial)