def make_array_for_comb(N, mod=10**9+7):
    fact = [1,1]
    fact_inv = [1,1]
    inv = [0,1]
    for i in range(2, N+1):
        fact.append((fact[-1]*i) % mod)
        # モジュラ逆数の性質
        inv.append((-inv[mod%i] * (mod//i)) % mod)
        fact_inv.append((fact_inv[-1]*inv[i]) % mod)
    return fact, fact_inv

def comb(n, r, mod=10**9+7):
  if (r < 0) or (n < r):
      return 0
  r = min(r, n - r)
  return fact[n] * fact_inv[r] * fact_inv[n-r] % mod

n,k = [int(i) for i in input().split()]
mod = 10**9+7
fact, fact_inv = make_array_for_comb(n,mod)
ans = 0

for i in range(min(n,k+1)):
  ans += (comb(n,i,mod)*comb(n-1,i,mod)%mod)
  ans %= mod
  
print(ans) def make_array_for_comb(N, mod=10**9+7):
    fact = [1,1]
    fact_inv = [1,1]
    inv = [0,1]
    for i in range(2, N+1):
        fact.append((fact[-1]*i) % mod)
        # モジュラ逆数の性質
        inv.append((-inv[mod%i] * (mod//i)) % mod)
        fact_inv.append((fact_inv[-1]*inv[i]) % mod)
    return fact, fact_inv make_array_for_comb fact = [1,1] fact [1,1] 1 1 fact_inv = [1,1] fact_inv [1,1] 1 1 inv = [0,1] inv [0,1] 0 1 for i in range(2, N+1):
        fact.append((fact[-1]*i) % mod)
        # モジュラ逆数の性質
        inv.append((-inv[mod%i] * (mod//i)) % mod)
        fact_inv.append((fact_inv[-1]*inv[i]) % mod)
     i range(2, N+1) range 2 N+1 N 1 fact.append((fact[-1]*i) % mod) fact.append fact append (fact[-1]*i) % mod fact[-1]*i fact[-1] fact -1 i mod inv.append((-inv[mod%i] * (mod//i)) % mod) inv.append inv append (-inv[mod%i] * (mod//i)) % mod -inv[mod%i] * (mod//i) -inv[mod%i] inv[mod%i] inv mod%i mod i mod//i mod i mod fact_inv.append((fact_inv[-1]*inv[i]) % mod) fact_inv.append fact_inv append (fact_inv[-1]*inv[i]) % mod fact_inv[-1]*inv[i] fact_inv[-1] fact_inv -1 inv[i] inv i mod return fact, fact_inv return fact, fact_inv fact fact_inv N N mod=10**9+7 mod 10**9+7 10**9 10 9 7 def comb(n, r, mod=10**9+7):
  if (r < 0) or (n < r):
      return 0
  r = min(r, n - r)
  return fact[n] * fact_inv[r] * fact_inv[n-r] % mod comb if (r < 0) or (n < r):
      return 0
   (r < 0) or (n < r) r < 0 r 0 n < r n r return 0 0 r = min(r, n - r) r min(r, n - r) min r n - r n r return fact[n] * fact_inv[r] * fact_inv[n-r] % mod fact[n] * fact_inv[r] * fact_inv[n-r] % mod fact[n] * fact_inv[r] * fact_inv[n-r] fact[n] * fact_inv[r] fact[n] fact n fact_inv[r] fact_inv r fact_inv[n-r] fact_inv n-r n r mod n n r r mod=10**9+7 mod 10**9+7 10**9 10 9 7 int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i n,k = [int(i) for i in input().split()] n [int(i) for i in input().split()] k mod = 10**9+7 mod 10**9+7 10**9 10 9 7 fact, fact_inv = make_array_for_comb(n,mod) fact make_array_for_comb(n,mod) make_array_for_comb n mod fact_inv ans = 0 ans 0 for i in range(min(n,k+1)):
  ans += (comb(n,i,mod)*comb(n-1,i,mod)%mod)
  ans %= mod
   i range(min(n,k+1)) range min(n,k+1) min n k+1 k 1 ans += (comb(n,i,mod)*comb(n-1,i,mod)%mod) ans comb(n,i,mod)*comb(n-1,i,mod)%mod comb(n,i,mod)*comb(n-1,i,mod) comb(n,i,mod) comb n i mod comb(n-1,i,mod) comb n-1 n 1 i mod mod ans %= mod ans mod print(ans) print ans def make_array_for_comb(N, mod=10**9+7):
    fact = [1,1]
    fact_inv = [1,1]
    inv = [0,1]
    for i in range(2, N+1):
        fact.append((fact[-1]*i) % mod)
        # モジュラ逆数の性質
        inv.append((-inv[mod%i] * (mod//i)) % mod)
        fact_inv.append((fact_inv[-1]*inv[i]) % mod)
    return fact, fact_inv def make_array_for_comb(N, mod=10**9+7):
    fact = [1,1]
    fact_inv = [1,1]
    inv = [0,1]
    for i in range(2, N+1):
        fact.append((fact[-1]*i) % mod)
        # モジュラ逆数の性質
        inv.append((-inv[mod%i] * (mod//i)) % mod)
        fact_inv.append((fact_inv[-1]*inv[i]) % mod)
    return fact, fact_inv make_array_for_comb fact, fact_inv = make_array_for_comb(n,mod) make_array_for_comb(n,mod) fact fact_inv = make_array_for_comb(n,mod) make_array_for_comb(n,mod) fact_inv def comb(n, r, mod=10**9+7):
  if (r < 0) or (n < r):
      return 0
  r = min(r, n - r)
  return fact[n] * fact_inv[r] * fact_inv[n-r] % mod def comb(n, r, mod=10**9+7):
  if (r < 0) or (n < r):
      return 0
  r = min(r, n - r)
  return fact[n] * fact_inv[r] * fact_inv[n-r] % mod comb n,k = [int(i) for i in input().split()] [int(i) for i in input().split()] n ans %= mod mod ans k = [int(i) for i in input().split()] [int(i) for i in input().split()] k ans = 0 0 ans mod = 10**9+7 10**9+7 mod ans += (comb(n,i,mod)*comb(n-1,i,mod)%mod) comb(n,i,mod)*comb(n-1,i,mod)%mod ans
def make_array_for_comb(N, mod=10**9+7):
    fact = [1,1]
    fact_inv = [1,1]
    inv = [0,1]
    for i in range(2, N+1):
        fact.append((fact[-1]*i) % mod)
        # モジュラ逆数の性質
        inv.append((-inv[mod%i] * (mod//i)) % mod)
        fact_inv.append((fact_inv[-1]*inv[i]) % mod)
    return fact, fact_inv

def comb(n, r, mod=10**9+7):
  if (r < 0) or (n < r):
      return 0
  r = min(r, n - r)
  return fact[n] * fact_inv[r] * fact_inv[n-r] % mod

n,k = [int(i) for i in input().split()]
mod = 10**9+7
fact, fact_inv = make_array_for_comb(n,mod)
ans = 0

for i in range(min(n,k+1)):
  ans += (comb(n,i,mod)*comb(n-1,i,mod)%mod)
  ans %= mod
  
print(ans)