local mmi, mma = math.min, math.max
local mod = 1000000007
local mfl = math.floor

local function badd(x, y)
  return (x + y) % mod
end
local function bmul(x, y)
  return (x * y) % mod
end

local invs = {1}
local fact = {1}
local invfact = {1}
for i = 2, 500000 do
  fact[i] = bmul(fact[i - 1], i)
  invs[i] = bmul(mfl(mod / i), mod - invs[mod % i])
  invfact[i] = bmul(invfact[i - 1], invs[i])
end

local function getComb(n, k)
  if k == 0 or n == k then return 1 end
  return bmul(fact[n], bmul(invfact[k], invfact[n - k]))
end

local n, k = io.read("*n", "*n")

k = mmi(n - 1, k)
local ret = 0
for i = 0, k do
  local v1 = getComb(n, i)
  local use = n - i
  local v2 = getComb(i + use - 1, use - 1)
  ret = badd(ret, bmul(v1, v2))
end
print(ret)
