import math
import sys

sys.setrecursionlimit(10**9)

MOD = 10**9+7

n, k = map(int, input().split())
k = min(k, n-1)

fact = [1]
for i in range(1, 10**6):
    fact.append((fact[i-1]*i)%MOD)

inv = [None]*10**6
def inv_fact(n):
    if inv[n] == None:
        inv[n] = pow(fact[n], MOD-2, MOD)
    return inv[n]

def comb(n, r):
    return (fact[n]*inv_fact(n-r)*inv_fact(r))%MOD

ans = 0
for i in range(k+1):
    ans = (ans + comb(n-1, i)*comb(n, i))%MOD
print(ans) import math math import sys sys sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k k = min(k, n-1) k min(k, n-1) min k n-1 n 1 fact = [1] fact [1] 1 for i in range(1, 10**6):
    fact.append((fact[i-1]*i)%MOD) i range(1, 10**6) range 1 10**6 10 6 fact.append((fact[i-1]*i)%MOD) fact.append fact append (fact[i-1]*i)%MOD fact[i-1]*i fact[i-1] fact i-1 i 1 i MOD inv = [None]*10**6 inv [None]*10**6 [None] None 10**6 10 6 def inv_fact(n):
    if inv[n] == None:
        inv[n] = pow(fact[n], MOD-2, MOD)
    return inv[n] inv_fact if inv[n] == None:
        inv[n] = pow(fact[n], MOD-2, MOD)
     inv[n] == None inv[n] inv n None inv[n] = pow(fact[n], MOD-2, MOD) inv[n] inv n pow(fact[n], MOD-2, MOD) pow fact[n] fact n MOD-2 MOD 2 MOD return inv[n] inv[n] inv n n n def comb(n, r):
    return (fact[n]*inv_fact(n-r)*inv_fact(r))%MOD comb return (fact[n]*inv_fact(n-r)*inv_fact(r))%MOD (fact[n]*inv_fact(n-r)*inv_fact(r))%MOD fact[n]*inv_fact(n-r)*inv_fact(r) fact[n]*inv_fact(n-r) fact[n] fact n inv_fact(n-r) inv_fact n-r n r inv_fact(r) inv_fact r MOD n n r r ans = 0 ans 0 for i in range(k+1):
    ans = (ans + comb(n-1, i)*comb(n, i))%MOD i range(k+1) range k+1 k 1 ans = (ans + comb(n-1, i)*comb(n, i))%MOD ans (ans + comb(n-1, i)*comb(n, i))%MOD ans + comb(n-1, i)*comb(n, i) ans comb(n-1, i)*comb(n, i) comb(n-1, i) comb n-1 n 1 i comb(n, i) comb n i MOD print(ans) print ans fact = [1] [1] fact inv = [None]*10**6 [None]*10**6 inv ans = (ans + comb(n-1, i)*comb(n, i))%MOD (ans + comb(n-1, i)*comb(n, i))%MOD ans k = map(int, input().split()) map(int, input().split()) k def inv_fact(n):
    if inv[n] == None:
        inv[n] = pow(fact[n], MOD-2, MOD)
    return inv[n] def inv_fact(n):
    if inv[n] == None:
        inv[n] = pow(fact[n], MOD-2, MOD)
    return inv[n] inv_fact ans = 0 0 ans MOD = 10**9+7 10**9+7 MOD k = min(k, n-1) min(k, n-1) k n, k = map(int, input().split()) map(int, input().split()) n def comb(n, r):
    return (fact[n]*inv_fact(n-r)*inv_fact(r))%MOD def comb(n, r):
    return (fact[n]*inv_fact(n-r)*inv_fact(r))%MOD comb
import math
import sys

sys.setrecursionlimit(10**9)

MOD = 10**9+7

n, k = map(int, input().split())
k = min(k, n-1)

fact = [1]
for i in range(1, 10**6):
    fact.append((fact[i-1]*i)%MOD)

inv = [None]*10**6
def inv_fact(n):
    if inv[n] == None:
        inv[n] = pow(fact[n], MOD-2, MOD)
    return inv[n]

def comb(n, r):
    return (fact[n]*inv_fact(n-r)*inv_fact(r))%MOD

ans = 0
for i in range(k+1):
    ans = (ans + comb(n-1, i)*comb(n, i))%MOD
print(ans)