class Combination:
  def __init__(self, n_max, mod=10**9+7):
    self.mod = mod
    self.modinv = self.make_modinv_list(n_max)
    self.fac, self.facinv = self.make_factorial_list(n_max)

  def __call__(self, n, r):
    return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

  def make_factorial_list(self, n):
    # 階乗のリストと階乗のmod逆元のリストを返す O(n)
    # self.make_modinv_list()が先に実行されている必要がある
    fac = [1]
    facinv = [1]
    for i in range(1, n+1):
      fac.append(fac[i-1] * i % self.mod)
      facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
    return fac, facinv

  def make_modinv_list(self, n):
    # 0からnまでのmod逆元のリストを返す O(n)
    modinv = [0] * (n+1)
    modinv[1] = 1
    for i in range(2, n+1):
      modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
    return modinv

n,k = map(int,input().split())
ans = 1
MOD = 10**9+7
comb = Combination(2*10**5+1)
for i in range(1, min(n, k+1)):
  ans += (comb(n,i)*comb(n-1, i))%MOD
  ans %= MOD

print(ans) class Combination:
  def __init__(self, n_max, mod=10**9+7):
    self.mod = mod
    self.modinv = self.make_modinv_list(n_max)
    self.fac, self.facinv = self.make_factorial_list(n_max)

  def __call__(self, n, r):
    return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

  def make_factorial_list(self, n):
    # 階乗のリストと階乗のmod逆元のリストを返す O(n)
    # self.make_modinv_list()が先に実行されている必要がある
    fac = [1]
    facinv = [1]
    for i in range(1, n+1):
      fac.append(fac[i-1] * i % self.mod)
      facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
    return fac, facinv

  def make_modinv_list(self, n):
    # 0からnまでのmod逆元のリストを返す O(n)
    modinv = [0] * (n+1)
    modinv[1] = 1
    for i in range(2, n+1):
      modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
    return modinv Combination def __init__(self, n_max, mod=10**9+7):
    self.mod = mod
    self.modinv = self.make_modinv_list(n_max)
    self.fac, self.facinv = self.make_factorial_list(n_max)

   __init__ self.mod = mod self.mod self mod mod self.modinv = self.make_modinv_list(n_max) self.modinv self modinv self.make_modinv_list(n_max) self.make_modinv_list self make_modinv_list n_max self.fac, self.facinv = self.make_factorial_list(n_max) self.fac self fac self.make_factorial_list(n_max) self.make_factorial_list self make_factorial_list n_max self.facinv self facinv self self n_max n_max mod=10**9+7 mod 10**9+7 10**9 10 9 7 def __call__(self, n, r):
    return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

   __call__ return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] self.fac[n] * self.facinv[r] % self.mod self.fac[n] * self.facinv[r] self.fac[n] self.fac self fac n self.facinv[r] self.facinv self facinv r self.mod self mod self.facinv[n-r] self.facinv self facinv n-r n r self.mod self mod self self n n r r def make_factorial_list(self, n):
    # 階乗のリストと階乗のmod逆元のリストを返す O(n)
    # self.make_modinv_list()が先に実行されている必要がある
    fac = [1]
    facinv = [1]
    for i in range(1, n+1):
      fac.append(fac[i-1] * i % self.mod)
      facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
    return fac, facinv

   make_factorial_list fac = [1] fac [1] 1 facinv = [1] facinv [1] 1 for i in range(1, n+1):
      fac.append(fac[i-1] * i % self.mod)
      facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
     i range(1, n+1) range 1 n+1 n 1 fac.append(fac[i-1] * i % self.mod) fac.append fac append fac[i-1] * i % self.mod fac[i-1] * i fac[i-1] fac i-1 i 1 i self.mod self mod facinv.append(facinv[i-1] * self.modinv[i] % self.mod) facinv.append facinv append facinv[i-1] * self.modinv[i] % self.mod facinv[i-1] * self.modinv[i] facinv[i-1] facinv i-1 i 1 self.modinv[i] self.modinv self modinv i self.mod self mod return fac, facinv return fac, facinv fac facinv self self n n def make_modinv_list(self, n):
    # 0からnまでのmod逆元のリストを返す O(n)
    modinv = [0] * (n+1)
    modinv[1] = 1
    for i in range(2, n+1):
      modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
    return modinv make_modinv_list modinv = [0] * (n+1) modinv [0] * (n+1) [0] 0 n+1 n 1 modinv[1] = 1 modinv[1] modinv 1 1 for i in range(2, n+1):
      modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
     i range(2, n+1) range 2 n+1 n 1 modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod modinv[i] modinv i self.mod - self.mod//i * modinv[self.mod%i] % self.mod self.mod self mod self.mod//i * modinv[self.mod%i] % self.mod self.mod//i * modinv[self.mod%i] self.mod//i self.mod self mod i modinv[self.mod%i] modinv self.mod%i self.mod self mod i self.mod self mod return modinv modinv self self n n n,k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k ans = 1 ans 1 MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 comb = Combination(2*10**5+1) comb Combination(2*10**5+1) Combination 2*10**5+1 2*10**5 2 10**5 10 5 1 for i in range(1, min(n, k+1)):
  ans += (comb(n,i)*comb(n-1, i))%MOD
  ans %= MOD i range(1, min(n, k+1)) range 1 min(n, k+1) min n k+1 k 1 ans += (comb(n,i)*comb(n-1, i))%MOD ans (comb(n,i)*comb(n-1, i))%MOD comb(n,i)*comb(n-1, i) comb(n,i) comb n i comb(n-1, i) comb n-1 n 1 i MOD ans %= MOD ans MOD print(ans) print ans class Combination:
  def __init__(self, n_max, mod=10**9+7):
    self.mod = mod
    self.modinv = self.make_modinv_list(n_max)
    self.fac, self.facinv = self.make_factorial_list(n_max)

  def __call__(self, n, r):
    return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

  def make_factorial_list(self, n):
    # 階乗のリストと階乗のmod逆元のリストを返す O(n)
    # self.make_modinv_list()が先に実行されている必要がある
    fac = [1]
    facinv = [1]
    for i in range(1, n+1):
      fac.append(fac[i-1] * i % self.mod)
      facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
    return fac, facinv

  def make_modinv_list(self, n):
    # 0からnまでのmod逆元のリストを返す O(n)
    modinv = [0] * (n+1)
    modinv[1] = 1
    for i in range(2, n+1):
      modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
    return modinv class Combination:
  def __init__(self, n_max, mod=10**9+7):
    self.mod = mod
    self.modinv = self.make_modinv_list(n_max)
    self.fac, self.facinv = self.make_factorial_list(n_max)

  def __call__(self, n, r):
    return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

  def make_factorial_list(self, n):
    # 階乗のリストと階乗のmod逆元のリストを返す O(n)
    # self.make_modinv_list()が先に実行されている必要がある
    fac = [1]
    facinv = [1]
    for i in range(1, n+1):
      fac.append(fac[i-1] * i % self.mod)
      facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
    return fac, facinv

  def make_modinv_list(self, n):
    # 0からnまでのmod逆元のリストを返す O(n)
    modinv = [0] * (n+1)
    modinv[1] = 1
    for i in range(2, n+1):
      modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
    return modinv Combination k = map(int,input().split()) map(int,input().split()) k MOD = 10**9+7 10**9+7 MOD ans += (comb(n,i)*comb(n-1, i))%MOD (comb(n,i)*comb(n-1, i))%MOD ans ans = 1 1 ans comb = Combination(2*10**5+1) Combination(2*10**5+1) comb ans %= MOD MOD ans n,k = map(int,input().split()) map(int,input().split()) n
class Combination:
  def __init__(self, n_max, mod=10**9+7):
    self.mod = mod
    self.modinv = self.make_modinv_list(n_max)
    self.fac, self.facinv = self.make_factorial_list(n_max)

  def __call__(self, n, r):
    return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

  def make_factorial_list(self, n):
    # 階乗のリストと階乗のmod逆元のリストを返す O(n)
    # self.make_modinv_list()が先に実行されている必要がある
    fac = [1]
    facinv = [1]
    for i in range(1, n+1):
      fac.append(fac[i-1] * i % self.mod)
      facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
    return fac, facinv

  def make_modinv_list(self, n):
    # 0からnまでのmod逆元のリストを返す O(n)
    modinv = [0] * (n+1)
    modinv[1] = 1
    for i in range(2, n+1):
      modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
    return modinv

n,k = map(int,input().split())
ans = 1
MOD = 10**9+7
comb = Combination(2*10**5+1)
for i in range(1, min(n, k+1)):
  ans += (comb(n,i)*comb(n-1, i))%MOD
  ans %= MOD

print(ans)
