def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

# 逆元事前処理ver
# nが小さい場合に
lim = 10 ** 6 + 1
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, lim + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    # 累計
    factinv.append((factinv[-1] * inv[-1]) % mod)

def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % mod

N, K = getNM()

# 部屋がn個
# 重複組み合わせ？

# つまり数え上げ
# 人数が0人の部屋がいくつあるか
# 0 ~ N - 1人
# 0人の部屋が0個の場合
# kが偶数ならいける kが1の場合はダメ
# kの回数は何か関係あるか

# k >= 2の時0人の部屋0人ができる
# 0人の部屋1人ができるのは？　k >= 1の時

if K >= 2:
    ans = 1 # 0人の部屋0人
else:
    ans = 0

for k in range(1, min(K + 1, N)):
    # 0の場所を決める *
    # 球があるN - kの部屋の仕切りN - k - 1の仕切り方について考える
    # ただし各部屋１個以上なければならないので自由に動かせる球はk個
    # kHN-k-1
    ans += cmb(N, k) * cmb(N - 1, N - k - 1)
    ans %= mod
print(ans % mod) def getN():
    return int(input()) getN return int(input()) int(input()) int input() input def getNM():
    return map(int, input().split()) getNM return map(int, input().split()) map(int, input().split()) map int input().split() ().split () input split def getList():
    return list(map(int, input().split())) getList return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def getArray(intn):
    return [int(input()) for i in range(intn)] getArray int(input()) for i in range(intn) for i in range(intn) i range(intn) range intn for i in range(intn) int(input()) int input() input return [int(input()) for i in range(intn)] [int(input()) for i in range(intn)] intn intn def input():
    return sys.stdin.readline().rstrip() input return sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip def rand_N(ran1, ran2):
    return random.randint(ran1, ran2) rand_N return random.randint(ran1, ran2) random.randint(ran1, ran2) random.randint random randint ran1 ran2 ran1 ran1 ran2 ran2 def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)] rand_List random.randint(ran1, ran2) for i in range(rantime) for i in range(rantime) i range(rantime) range rantime for i in range(rantime) random.randint(ran1, ran2) random.randint random randint ran1 ran2 return [random.randint(ran1, ran2) for i in range(rantime)] [random.randint(ran1, ran2) for i in range(rantime)] ran1 ran1 ran2 ran2 rantime rantime def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns) rand_ints_nodup ns = [] ns [] while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
   len(ns) < rantime len(ns) len ns rantime n = random.randint(ran1, ran2) n random.randint(ran1, ran2) random.randint random randint ran1 ran2 if not n in ns:
      ns.append(n)
   not n in ns n in ns n ns ns.append(n) ns.append ns append n return sorted(ns) sorted(ns) sorted ns ran1 ran1 ran2 ran2 rantime rantime def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query) rand_query r_query = [] r_query [] while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
   len(r_query) < rantime len(r_query) len r_query rantime n_q = rand_ints_nodup(ran1, ran2, 2) n_q rand_ints_nodup(ran1, ran2, 2) rand_ints_nodup ran1 ran2 2 if not n_q in r_query:
      r_query.append(n_q)
   not n_q in r_query n_q in r_query n_q r_query r_query.append(n_q) r_query.append r_query append n_q return sorted(r_query) sorted(r_query) sorted r_query ran1 ran1 ran2 ran2 rantime rantime from collections import defaultdict, deque, Counter from sys import exit from decimal import * from heapq import heapify, heappop, heappush import math math import random random import string string from copy import deepcopy from itertools import combinations, permutations, product from operator import mul, itemgetter from functools import reduce from bisect import bisect_left, bisect_right import sys sys sys.setrecursionlimit(1000000000) sys.setrecursionlimit sys setrecursionlimit 1000000000 mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 lim = 10 ** 6 + 1 lim 10 ** 6 + 1 10 ** 6 10 6 1 fact = [1, 1] fact [1, 1] 1 1 factinv = [1, 1] factinv [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 for i in range(2, lim + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    # 累計
    factinv.append((factinv[-1] * inv[-1]) % mod) i range(2, lim + 1) range 2 lim + 1 lim 1 fact.append((fact[-1] * i) % mod) fact.append fact append (fact[-1] * i) % mod fact[-1] * i fact[-1] fact -1 i mod inv.append((-inv[mod % i] * (mod // i)) % mod) inv.append inv append (-inv[mod % i] * (mod // i)) % mod -inv[mod % i] * (mod // i) -inv[mod % i] inv[mod % i] inv mod % i mod i mod // i mod i mod factinv.append((factinv[-1] * inv[-1]) % mod) factinv.append factinv append (factinv[-1] * inv[-1]) % mod factinv[-1] * inv[-1] factinv[-1] factinv -1 inv[-1] inv -1 mod def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % mod cmb if (r < 0) or (n < r):
        return 0
     (r < 0) or (n < r) r < 0 r 0 n < r n r return 0 0 r = min(r, n - r) r min(r, n - r) min r n - r n r return fact[n] * factinv[r] * factinv[n - r] % mod fact[n] * factinv[r] * factinv[n - r] % mod fact[n] * factinv[r] * factinv[n - r] fact[n] * factinv[r] fact[n] fact n factinv[r] factinv r factinv[n - r] factinv n - r n r mod n n r r N, K = getNM() N getNM() getNM K if K >= 2:
    ans = 1 # 0人の部屋0人
else:
    ans = 0 K >= 2 K 2 ans = 1 ans 1 ans = 0 ans 0 for k in range(1, min(K + 1, N)):
    # 0の場所を決める *
    # 球があるN - kの部屋の仕切りN - k - 1の仕切り方について考える
    # ただし各部屋１個以上なければならないので自由に動かせる球はk個
    # kHN-k-1
    ans += cmb(N, k) * cmb(N - 1, N - k - 1)
    ans %= mod k range(1, min(K + 1, N)) range 1 min(K + 1, N) min K + 1 K 1 N ans += cmb(N, k) * cmb(N - 1, N - k - 1) ans cmb(N, k) * cmb(N - 1, N - k - 1) cmb(N, k) cmb N k cmb(N - 1, N - k - 1) cmb N - 1 N 1 N - k - 1 N - k N k 1 ans %= mod ans mod print(ans % mod) print ans % mod ans mod def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query) def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query) rand_query ans = 0 0 ans def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns) def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns) rand_ints_nodup lim = 10 ** 6 + 1 10 ** 6 + 1 lim def getN():
    return int(input()) def getN():
    return int(input()) getN ans += cmb(N, k) * cmb(N - 1, N - k - 1) cmb(N, k) * cmb(N - 1, N - k - 1) ans def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % mod def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % mod cmb ans = 1 1 ans def getArray(intn):
    return [int(input()) for i in range(intn)] def getArray(intn):
    return [int(input()) for i in range(intn)] getArray def rand_N(ran1, ran2):
    return random.randint(ran1, ran2) def rand_N(ran1, ran2):
    return random.randint(ran1, ran2) rand_N K = getNM() getNM() K ans %= mod mod ans inv = [0, 1] [0, 1] inv def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)] def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)] rand_List mod = 10 ** 9 + 7 10 ** 9 + 7 mod factinv = [1, 1] [1, 1] factinv fact = [1, 1] [1, 1] fact def input():
    return sys.stdin.readline().rstrip() def input():
    return sys.stdin.readline().rstrip() input def getNM():
    return map(int, input().split()) def getNM():
    return map(int, input().split()) getNM def getList():
    return list(map(int, input().split())) def getList():
    return list(map(int, input().split())) getList N, K = getNM() getNM() N
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

# 逆元事前処理ver
# nが小さい場合に
lim = 10 ** 6 + 1
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, lim + 1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    # 累計
    factinv.append((factinv[-1] * inv[-1]) % mod)

def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % mod

N, K = getNM()

# 部屋がn個
# 重複組み合わせ？

# つまり数え上げ
# 人数が0人の部屋がいくつあるか
# 0 ~ N - 1人
# 0人の部屋が0個の場合
# kが偶数ならいける kが1の場合はダメ
# kの回数は何か関係あるか

# k >= 2の時0人の部屋0人ができる
# 0人の部屋1人ができるのは？　k >= 1の時

if K >= 2:
    ans = 1 # 0人の部屋0人
else:
    ans = 0

for k in range(1, min(K + 1, N)):
    # 0の場所を決める *
    # 球があるN - kの部屋の仕切りN - k - 1の仕切り方について考える
    # ただし各部屋１個以上なければならないので自由に動かせる球はk個
    # kHN-k-1
    ans += cmb(N, k) * cmb(N - 1, N - k - 1)
    ans %= mod
print(ans % mod)