import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = 10**6#float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

		
#階乗#
lim = 4*10**5   #必要そうな階乗の限界を入力
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

#階乗の逆元#
fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod

n, k = MAP()

if n-1 <= k:
	print(C(2*n-1, n))
	exit()

ans = 0
for i in range(k+1):
	ans += C(n, i) * C(n-1, i) % mod
	ans %= mod

print(ans)
 import sys, re sys re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left, insort, insort_left from heapq import heappush, heappop from functools import reduce, lru_cache def input(): return sys.stdin.readline().strip() input def INT(): return int(input()) INT def MAP(): return map(int, input().split()) MAP def LIST(): return list(map(int, input().split())) LIST def TUPLE(): return tuple(map(int, input().split())) TUPLE MAP() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) MAP() MAP def ZIP(n): return zip(*(MAP() for _ in range(n))) ZIP n n sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = 10**6 INF 10**6 10 6 mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 from decimal import * lim = 4*10**5 lim 4*10**5 4 10**5 10 5 fact = [1] * (lim+1) fact [1] * (lim+1) [1] 1 lim+1 lim 1 for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

#階乗の逆元# n range(1, lim+1) range 1 lim+1 lim 1 fact[n] = n * fact[n-1] % mod fact[n] fact n n * fact[n-1] % mod n * fact[n-1] n fact[n-1] fact n-1 n 1 mod fact_inv = [1]*(lim+1) fact_inv [1]*(lim+1) [1] 1 lim+1 lim 1 fact_inv[lim] = pow(fact[lim], mod-2, mod) fact_inv[lim] fact_inv lim pow(fact[lim], mod-2, mod) pow fact[lim] fact lim mod-2 mod 2 mod for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod n range(lim, 0, -1) range lim 0 -1 fact_inv[n-1] = n*fact_inv[n]%mod fact_inv[n-1] fact_inv n-1 n 1 n*fact_inv[n]%mod n*fact_inv[n] n fact_inv[n] fact_inv n mod def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod C return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod (fact[n]*fact_inv[r]%mod)*fact_inv[n-r] fact[n]*fact_inv[r]%mod fact[n]*fact_inv[r] fact[n] fact n fact_inv[r] fact_inv r mod fact_inv[n-r] fact_inv n-r n r mod n n r r n, k = MAP() n MAP() MAP k if n-1 <= k:
	print(C(2*n-1, n))
	exit() n-1 <= k n-1 n 1 k print(C(2*n-1, n)) print C(2*n-1, n) C 2*n-1 2*n 2 n 1 n exit() exit ans = 0 ans 0 for i in range(k+1):
	ans += C(n, i) * C(n-1, i) % mod
	ans %= mod i range(k+1) range k+1 k 1 ans += C(n, i) * C(n-1, i) % mod ans C(n, i) * C(n-1, i) % mod C(n, i) * C(n-1, i) C(n, i) C n i C(n-1, i) C n-1 n 1 i mod ans %= mod ans mod print(ans) print ans fact = [1] * (lim+1) [1] * (lim+1) fact k = MAP() MAP() k def INT(): return int(input()) def INT(): return int(input()) INT n, k = MAP() MAP() n mod = 10 ** 9 + 7 10 ** 9 + 7 mod def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input def ZIP(n): return zip(*(MAP() for _ in range(n))) def ZIP(n): return zip(*(MAP() for _ in range(n))) ZIP def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod C def TUPLE(): return tuple(map(int, input().split())) def TUPLE(): return tuple(map(int, input().split())) TUPLE ans = 0 0 ans ans += C(n, i) * C(n-1, i) % mod C(n, i) * C(n-1, i) % mod ans INF = 10**6 10**6 INF ans %= mod mod ans def MAP(): return map(int, input().split()) def MAP(): return map(int, input().split()) MAP def LIST(): return list(map(int, input().split())) def LIST(): return list(map(int, input().split())) LIST fact_inv = [1]*(lim+1) [1]*(lim+1) fact_inv lim = 4*10**5 4*10**5 lim
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = 10**6#float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

		
#階乗#
lim = 4*10**5   #必要そうな階乗の限界を入力
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

#階乗の逆元#
fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod

n, k = MAP()

if n-1 <= k:
	print(C(2*n-1, n))
	exit()

ans = 0
for i in range(k+1):
	ans += C(n, i) * C(n-1, i) % mod
	ans %= mod

print(ans)

