class mod_comb_k():
  def __init__(self, MAX_N = 10**6, mod = 10**9+7):
    self.fact = [1]
    self.fact_inv = [0] * (MAX_N + 4)
    self.mod = mod
    for i in range(MAX_N + 3):
      self.fact.append(self.fact[-1] * (i + 1) % self.mod)
    self.fact_inv[-1] = pow(self.fact[-1], self.mod - 2, self.mod)
    for i in range(MAX_N + 2, -1, -1):
      self.fact_inv[i] = self.fact_inv[i + 1] * (i + 1) % self.mod
  def comb(self, n, k):
    if n < k:return 0
    else:return self.fact[n] * self.fact_inv[k] % self.mod * self.fact_inv[n - k] % self.mod
c=mod_comb_k()
n,k=map(int,input().split())
if k>=n:print(c.comb(2*n-1,n))
else:
  ans=0
  m=10**9+7
  for i in range(k+1):
    ans+=c.comb(n-1,i)*c.comb(n,i)%m
    ans%=m
  print(ans) class mod_comb_k():
  def __init__(self, MAX_N = 10**6, mod = 10**9+7):
    self.fact = [1]
    self.fact_inv = [0] * (MAX_N + 4)
    self.mod = mod
    for i in range(MAX_N + 3):
      self.fact.append(self.fact[-1] * (i + 1) % self.mod)
    self.fact_inv[-1] = pow(self.fact[-1], self.mod - 2, self.mod)
    for i in range(MAX_N + 2, -1, -1):
      self.fact_inv[i] = self.fact_inv[i + 1] * (i + 1) % self.mod
  def comb(self, n, k):
    if n < k:return 0
    else:return self.fact[n] * self.fact_inv[k] % self.mod * self.fact_inv[n - k] % self.mod mod_comb_k def __init__(self, MAX_N = 10**6, mod = 10**9+7):
    self.fact = [1]
    self.fact_inv = [0] * (MAX_N + 4)
    self.mod = mod
    for i in range(MAX_N + 3):
      self.fact.append(self.fact[-1] * (i + 1) % self.mod)
    self.fact_inv[-1] = pow(self.fact[-1], self.mod - 2, self.mod)
    for i in range(MAX_N + 2, -1, -1):
      self.fact_inv[i] = self.fact_inv[i + 1] * (i + 1) % self.mod
   __init__ self.fact = [1] self.fact self fact [1] 1 self.fact_inv = [0] * (MAX_N + 4) self.fact_inv self fact_inv [0] * (MAX_N + 4) [0] 0 MAX_N + 4 MAX_N 4 self.mod = mod self.mod self mod mod for i in range(MAX_N + 3):
      self.fact.append(self.fact[-1] * (i + 1) % self.mod)
     i range(MAX_N + 3) range MAX_N + 3 MAX_N 3 self.fact.append(self.fact[-1] * (i + 1) % self.mod) self.fact.append self.fact self fact append self.fact[-1] * (i + 1) % self.mod self.fact[-1] * (i + 1) self.fact[-1] self.fact self fact -1 i + 1 i 1 self.mod self mod self.fact_inv[-1] = pow(self.fact[-1], self.mod - 2, self.mod) self.fact_inv[-1] self.fact_inv self fact_inv -1 pow(self.fact[-1], self.mod - 2, self.mod) pow self.fact[-1] self.fact self fact -1 self.mod - 2 self.mod self mod 2 self.mod self mod for i in range(MAX_N + 2, -1, -1):
      self.fact_inv[i] = self.fact_inv[i + 1] * (i + 1) % self.mod
   i range(MAX_N + 2, -1, -1) range MAX_N + 2 MAX_N 2 -1 -1 self.fact_inv[i] = self.fact_inv[i + 1] * (i + 1) % self.mod self.fact_inv[i] self.fact_inv self fact_inv i self.fact_inv[i + 1] * (i + 1) % self.mod self.fact_inv[i + 1] * (i + 1) self.fact_inv[i + 1] self.fact_inv self fact_inv i + 1 i 1 i + 1 i 1 self.mod self mod self self MAX_N = 10**6 MAX_N 10**6 10 6 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 def comb(self, n, k):
    if n < k:return 0
    else:return self.fact[n] * self.fact_inv[k] % self.mod * self.fact_inv[n - k] % self.mod comb if n < k:return 0
    else:return self.fact[n] * self.fact_inv[k] % self.mod * self.fact_inv[n - k] % self.mod n < k n k self self n n k k c=mod_comb_k() c mod_comb_k() mod_comb_k n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k if k>=n:print(c.comb(2*n-1,n))
else:
  ans=0
  m=10**9+7
  for i in range(k+1):
    ans+=c.comb(n-1,i)*c.comb(n,i)%m
    ans%=m
  print(ans) k>=n k n ans=0 ans 0 m=10**9+7 m 10**9+7 10**9 10 9 7 for i in range(k+1):
    ans+=c.comb(n-1,i)*c.comb(n,i)%m
    ans%=m
   i range(k+1) range k+1 k 1 ans+=c.comb(n-1,i)*c.comb(n,i)%m ans c.comb(n-1,i)*c.comb(n,i)%m c.comb(n-1,i)*c.comb(n,i) c.comb(n-1,i) c.comb c comb n-1 n 1 i c.comb(n,i) c.comb c comb n i m ans%=m ans m print(ans) print ans c=mod_comb_k() mod_comb_k() c class mod_comb_k():
  def __init__(self, MAX_N = 10**6, mod = 10**9+7):
    self.fact = [1]
    self.fact_inv = [0] * (MAX_N + 4)
    self.mod = mod
    for i in range(MAX_N + 3):
      self.fact.append(self.fact[-1] * (i + 1) % self.mod)
    self.fact_inv[-1] = pow(self.fact[-1], self.mod - 2, self.mod)
    for i in range(MAX_N + 2, -1, -1):
      self.fact_inv[i] = self.fact_inv[i + 1] * (i + 1) % self.mod
  def comb(self, n, k):
    if n < k:return 0
    else:return self.fact[n] * self.fact_inv[k] % self.mod * self.fact_inv[n - k] % self.mod class mod_comb_k():
  def __init__(self, MAX_N = 10**6, mod = 10**9+7):
    self.fact = [1]
    self.fact_inv = [0] * (MAX_N + 4)
    self.mod = mod
    for i in range(MAX_N + 3):
      self.fact.append(self.fact[-1] * (i + 1) % self.mod)
    self.fact_inv[-1] = pow(self.fact[-1], self.mod - 2, self.mod)
    for i in range(MAX_N + 2, -1, -1):
      self.fact_inv[i] = self.fact_inv[i + 1] * (i + 1) % self.mod
  def comb(self, n, k):
    if n < k:return 0
    else:return self.fact[n] * self.fact_inv[k] % self.mod * self.fact_inv[n - k] % self.mod mod_comb_k k=map(int,input().split()) map(int,input().split()) k m=10**9+7 10**9+7 m n,k=map(int,input().split()) map(int,input().split()) n ans=0 0 ans ans+=c.comb(n-1,i)*c.comb(n,i)%m c.comb(n-1,i)*c.comb(n,i)%m ans ans%=m m ans
class mod_comb_k():
  def __init__(self, MAX_N = 10**6, mod = 10**9+7):
    self.fact = [1]
    self.fact_inv = [0] * (MAX_N + 4)
    self.mod = mod
    for i in range(MAX_N + 3):
      self.fact.append(self.fact[-1] * (i + 1) % self.mod)
    self.fact_inv[-1] = pow(self.fact[-1], self.mod - 2, self.mod)
    for i in range(MAX_N + 2, -1, -1):
      self.fact_inv[i] = self.fact_inv[i + 1] * (i + 1) % self.mod
  def comb(self, n, k):
    if n < k:return 0
    else:return self.fact[n] * self.fact_inv[k] % self.mod * self.fact_inv[n - k] % self.mod
c=mod_comb_k()
n,k=map(int,input().split())
if k>=n:print(c.comb(2*n-1,n))
else:
  ans=0
  m=10**9+7
  for i in range(k+1):
    ans+=c.comb(n-1,i)*c.comb(n,i)%m
    ans%=m
  print(ans)