P = 10**9+7
N = 700000 #使う最大値以上にする、値に注意4*10^5とかにしとくと安心
inv = [0] + [1] # 1/x
finv = [1] + [1] # 1/x!
fac = [1] + [1] # x!
for i in range(2,N+1):
  inv += [inv[P % i] * (P - int(P / i)) % P]
  fac += [(fac[i-1] * i) % P]
  finv += [(finv[i-1] * inv[i]) % P]

def comb(a, b):
    if a<b: return 0 # error
    return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P

n, k = map(int, input().split())

ans = 0
#0が0~min(n-1, k)
num = min(n-1, k) + 1
for i in range(num):
    heya = n - i
    #0
    ret = comb(n, i)
    person = n - heya
    ret = (ret * comb(person+heya-1, person))%P
    ans += ret
print(ans%P) P = 10**9+7 P 10**9+7 10**9 10 9 7 N = 700000 N 700000 inv = [0] + [1] inv [0] + [1] [0] 0 [1] 1 finv = [1] + [1] finv [1] + [1] [1] 1 [1] 1 fac = [1] + [1] fac [1] + [1] [1] 1 [1] 1 for i in range(2,N+1):
  inv += [inv[P % i] * (P - int(P / i)) % P]
  fac += [(fac[i-1] * i) % P]
  finv += [(finv[i-1] * inv[i]) % P] i range(2,N+1) range 2 N+1 N 1 inv += [inv[P % i] * (P - int(P / i)) % P] inv [inv[P % i] * (P - int(P / i)) % P] inv[P % i] * (P - int(P / i)) % P inv[P % i] * (P - int(P / i)) inv[P % i] inv P % i P i P - int(P / i) P int(P / i) int P / i P i P fac += [(fac[i-1] * i) % P] fac [(fac[i-1] * i) % P] (fac[i-1] * i) % P fac[i-1] * i fac[i-1] fac i-1 i 1 i P finv += [(finv[i-1] * inv[i]) % P] finv [(finv[i-1] * inv[i]) % P] (finv[i-1] * inv[i]) % P finv[i-1] * inv[i] finv[i-1] finv i-1 i 1 inv[i] inv i P def comb(a, b):
    if a<b: return 0 # error
    return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P comb if a<b: return 0 # error
     a<b a b return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P (fac[a] * ((finv[b] * finv[a-b]) % P)) %P fac[a] * ((finv[b] * finv[a-b]) % P) fac[a] fac a (finv[b] * finv[a-b]) % P finv[b] * finv[a-b] finv[b] finv b finv[a-b] finv a-b a b P P a a b b n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k ans = 0 ans 0 num = min(n-1, k) + 1 num min(n-1, k) + 1 min(n-1, k) min n-1 n 1 k 1 for i in range(num):
    heya = n - i
    #0
    ret = comb(n, i)
    person = n - heya
    ret = (ret * comb(person+heya-1, person))%P
    ans += ret i range(num) range num heya = n - i heya n - i n i ret = comb(n, i) ret comb(n, i) comb n i person = n - heya person n - heya n heya ret = (ret * comb(person+heya-1, person))%P ret (ret * comb(person+heya-1, person))%P ret * comb(person+heya-1, person) ret comb(person+heya-1, person) comb person+heya-1 person+heya person heya 1 person P ans += ret ans ret print(ans%P) print ans%P ans P def comb(a, b):
    if a<b: return 0 # error
    return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P def comb(a, b):
    if a<b: return 0 # error
    return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P comb heya = n - i n - i heya person = n - heya n - heya person inv = [0] + [1] [0] + [1] inv ret = comb(n, i) comb(n, i) ret n, k = map(int, input().split()) map(int, input().split()) n ret = (ret * comb(person+heya-1, person))%P (ret * comb(person+heya-1, person))%P ret num = min(n-1, k) + 1 min(n-1, k) + 1 num ans = 0 0 ans finv = [1] + [1] [1] + [1] finv N = 700000 700000 N fac = [1] + [1] [1] + [1] fac inv += [inv[P % i] * (P - int(P / i)) % P] [inv[P % i] * (P - int(P / i)) % P] inv fac += [(fac[i-1] * i) % P] [(fac[i-1] * i) % P] fac k = map(int, input().split()) map(int, input().split()) k ans += ret ret ans finv += [(finv[i-1] * inv[i]) % P] [(finv[i-1] * inv[i]) % P] finv P = 10**9+7 10**9+7 P
P = 10**9+7
N = 700000 #使う最大値以上にする、値に注意4*10^5とかにしとくと安心
inv = [0] + [1] # 1/x
finv = [1] + [1] # 1/x!
fac = [1] + [1] # x!
for i in range(2,N+1):
  inv += [inv[P % i] * (P - int(P / i)) % P]
  fac += [(fac[i-1] * i) % P]
  finv += [(finv[i-1] * inv[i]) % P]

def comb(a, b):
    if a<b: return 0 # error
    return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P

n, k = map(int, input().split())

ans = 0
#0が0~min(n-1, k)
num = min(n-1, k) + 1
for i in range(num):
    heya = n - i
    #0
    ret = comb(n, i)
    person = n - heya
    ret = (ret * comb(person+heya-1, person))%P
    ans += ret
print(ans%P)
