output_description: Print the number of possible combinations of numbers of people in the n rooms
  now, modulo (10^9 + 7).
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      n k
attempt: class Facts:
  
      def __init__(self, mod=10**9 + 7, n_max=1):
          self.mod = mod
          self.n_max = n_max
          self.fact = [1, 1]
          self.inv = [0, 1]
          self.factinv = [1, 1]
          if 1 < n_max:
              self.setup_table(n_max)
  
      def cmb(self, n, r):
          if r < 0 or n < r:
              return 0
          if self.n_max < n:
              self.setup_table(n)
          return (
              self.fact[n] * (self.factinv[r] * self.factinv[n - r] % self.mod) % self.mod
          )
  
      def factorial(self, n):
          if self.n_max < n:
              self.setup_table(n)
          return self.fact[n]
  
      def hom(self, n, k):
          return self.cmb(n + k - 1, k)
  
      def prm(self, n, k):
          if self.n_max < n:
              self.setup_table(n)
          return self.fact[n] * self.factinv[n - k] % self.mod
  
      def setup_table(self, t):
          for i in range(self.n_max + 1, t + 1):
              self.fact.append(self.fact[-1] * i % self.mod)
              self.inv.append(-self.inv[mod % i] * (self.mod // i) % self.mod)
              self.factinv.append(self.factinv[-1] * self.inv[-1] % self.mod)
          self.n_max = t
  
  
  # ABC156 Roaming
  mod = 10**9 + 7
  
  n, k = map(int, input().split())
  
  ans = 0
  f = Facts(mod)
  
  for i in range(0, min(n - 1, k) + 1):
      ans += f.cmb(n, i) * f.hom(n - i, i) % mod
      if ans >= mod:
          ans -= mod
  
  print(ans)
  
  # ABC167 E 2020/5/11
  # mod = 998244353
  
  # n, m, k = map(int, input().split())
  
  # ans = 0
  # f = Facts(mod)
  # t = m * pow(m-1, n-1-k, mod)
  
  # for i in range(k,-1,-1):
  #   ans += f.cmb(n-1,i) * t % mod
  #   t = t * (m-1) % mod
  
  # print(ans % mod)
  
problem_description: Statement
  
  There is a building with n rooms, numbered 1 to n.
  
  We can move from any room to any other room in the building.
  
  Let us call the following event a **move** : a person in some room i goes to
  another room j~ (i \neq j).
  
  Initially, there was one person in each room in the building.
  
  After that, we know that there were exactly k moves happened up to now.
  
  We are interested in the number of people in each of the n rooms now. How many
  combinations of numbers of people in the n rooms are possible?
  
  Find the count modulo (10^9 + 7).
samples: [{"input": "3 2", "output": "10\n    \n\nLet c_1, c_2, and c_3 be the number of people in Room 1, 2, and 3 now,\nrespectively. There are 10 possible combination of (c_1, c_2, c_3):\n\n  * (0, 0, 3)\n  * (0, 1, 2)\n  * (0, 2, 1)\n  * (0, 3, 0)\n  * (1, 0, 2)\n  * (1, 1, 1)\n  * (1, 2, 0)\n  * (2, 0, 1)\n  * (2, 1, 0)\n  * (3, 0, 0)\n\nFor example, (c_1, c_2, c_3) will be (0, 1, 2) if the person in Room 1 goes to\nRoom 2 and then one of the persons in Room 2 goes to Room 3.\n\n* * *"}, {"input": "200000 1000000000", "output": "607923868\n    \n\nPrint the count modulo (10^9 + 7).\n\n* * *"}, {"input": "15 6", "output": "22583772"}]