U = 5*10**5
MOD = 10**9+7
 
def main():
  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
      z = fact[n]
      z *= fact_inv[k]
      z *= fact_inv[n-k]
      z %= MOD
      return z

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

  n, k = map(int, input().split())
  if k+1 < n:
    ans = 0
    for i in range(k+1, n):
      ans += comb(n, i) * comb(n-1, i)
      ans %= MOD
    ans = comb(2*n-1, n) - ans
    ans %= MOD
  else:
    ans = comb(2*n-1, n)
  print(ans)
   main 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
      z = fact[n]
      z *= fact_inv[k]
      z *= fact_inv[n-k]
      z %= MOD
      return z

   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 z = fact[n] z fact[n] fact n z *= fact_inv[k] z fact_inv[k] fact_inv k z *= fact_inv[n-k] z fact_inv[n-k] fact_inv n-k n k z %= MOD z MOD return z z n n k k n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k if k+1 < n:
    ans = 0
    for i in range(k+1, n):
      ans += comb(n, i) * comb(n-1, i)
      ans %= MOD
    ans = comb(2*n-1, n) - ans
    ans %= MOD
  else:
    ans = comb(2*n-1, n)
   k+1 < n k+1 k 1 n ans = 0 ans 0 for i in range(k+1, n):
      ans += comb(n, i) * comb(n-1, i)
      ans %= MOD
     i range(k+1, n) range k+1 k 1 n ans += comb(n, i) * comb(n-1, i) ans comb(n, i) * comb(n-1, i) comb(n, i) comb n i comb(n-1, i) comb n-1 n 1 i ans %= MOD ans MOD ans = comb(2*n-1, n) - ans ans comb(2*n-1, n) - ans comb(2*n-1, n) comb 2*n-1 2*n 2 n 1 n ans ans %= MOD ans MOD ans = comb(2*n-1, n) ans comb(2*n-1, n) comb 2*n-1 2*n 2 n 1 n print(ans) print ans if __name__ == "__main__":
  main() __name__ == "__main__" __name__ "__main__" main() main def main():
  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
      z = fact[n]
      z *= fact_inv[k]
      z *= fact_inv[n-k]
      z %= MOD
      return z

  n, k = map(int, input().split())
  if k+1 < n:
    ans = 0
    for i in range(k+1, n):
      ans += comb(n, i) * comb(n-1, i)
      ans %= MOD
    ans = comb(2*n-1, n) - ans
    ans %= MOD
  else:
    ans = comb(2*n-1, n)
  print(ans)
   def main():
  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
      z = fact[n]
      z *= fact_inv[k]
      z *= fact_inv[n-k]
      z %= MOD
      return z

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

  n, k = map(int, input().split())
  if k+1 < n:
    ans = 0
    for i in range(k+1, n):
      ans += comb(n, i) * comb(n-1, i)
      ans %= MOD
    ans = comb(2*n-1, n) - ans
    ans %= MOD
  else:
    ans = comb(2*n-1, n)
  print(ans)
  
if __name__ == "__main__":
  main()