from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq

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

# C,Pを求める前処理
m = 4*10**5
mod = 10**9 + 7


fact = [0]*(m+5)
fact_inv = [0]*(m+5)
inv = [0]*(m+5)

fact[0] = fact[1] = 1
fact_inv[0] = fact_inv[1] = 1
inv[1] = 1

for i in range(2,m+5):
    fact[i] = fact[i-1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod

# nCkをmod（素数）で割った余りを求める．ただしn<10**7
# 前処理はm=n+5まで
def cmb(n,k,mod):
    return fact[n] * (fact_inv[k] * fact_inv[n-k] % mod) % mod

if k >= n-1:
    print(cmb(2*n-1, n-1, mod)%mod)
else:
    ans = 0
    for i in range(0,k+1):
        ans += cmb(n,i,mod)*cmb(n-1,n-i-1,mod)%mod
        ans %= mod
    print(ans)



 from sys import stdin import sys sys import math math from functools import reduce import functools functools import itertools itertools from collections import deque,Counter from operator import mul import copy copy import heapq heapq n,k = list(map(int, input().split())) n list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k m = 4*10**5 m 4*10**5 4 10**5 10 5 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 fact = [0]*(m+5) fact [0]*(m+5) [0] 0 m+5 m 5 fact_inv = [0]*(m+5) fact_inv [0]*(m+5) [0] 0 m+5 m 5 inv = [0]*(m+5) inv [0]*(m+5) [0] 0 m+5 m 5 fact[0] = fact[1] = 1 fact[0] fact 0 1 = fact[1] = 1 fact[1] fact 1 1 fact_inv[0] = fact_inv[1] = 1 fact_inv[0] fact_inv 0 1 = fact_inv[1] = 1 fact_inv[1] fact_inv 1 1 inv[1] = 1 inv[1] inv 1 1 for i in range(2,m+5):
    fact[i] = fact[i-1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod

# nCkをmod（素数）で割った余りを求める．ただしn<10**7
# 前処理はm=n+5まで i range(2,m+5) range 2 m+5 m 5 fact[i] = fact[i-1] * i % mod fact[i] fact i fact[i-1] * i % mod fact[i-1] * i fact[i-1] fact i-1 i 1 i mod inv[i] = mod - inv[mod % i] * (mod // i) % mod inv[i] inv i mod - inv[mod % i] * (mod // i) % mod mod inv[mod % i] * (mod // i) % mod inv[mod % i] * (mod // i) inv[mod % i] inv mod % i mod i mod // i mod i mod fact_inv[i] = fact_inv[i-1] * inv[i] % mod fact_inv[i] fact_inv i fact_inv[i-1] * inv[i] % mod fact_inv[i-1] * inv[i] fact_inv[i-1] fact_inv i-1 i 1 inv[i] inv i mod def cmb(n,k,mod):
    return fact[n] * (fact_inv[k] * fact_inv[n-k] % mod) % mod cmb return fact[n] * (fact_inv[k] * fact_inv[n-k] % mod) % mod fact[n] * (fact_inv[k] * fact_inv[n-k] % mod) % mod fact[n] * (fact_inv[k] * fact_inv[n-k] % mod) fact[n] fact n fact_inv[k] * fact_inv[n-k] % mod fact_inv[k] * fact_inv[n-k] fact_inv[k] fact_inv k fact_inv[n-k] fact_inv n-k n k mod mod n n k k mod mod if k >= n-1:
    print(cmb(2*n-1, n-1, mod)%mod)
else:
    ans = 0
    for i in range(0,k+1):
        ans += cmb(n,i,mod)*cmb(n-1,n-i-1,mod)%mod
        ans %= mod
    print(ans) k >= n-1 k n-1 n 1 print(cmb(2*n-1, n-1, mod)%mod) print cmb(2*n-1, n-1, mod)%mod cmb(2*n-1, n-1, mod) cmb 2*n-1 2*n 2 n 1 n-1 n 1 mod mod ans = 0 ans 0 for i in range(0,k+1):
        ans += cmb(n,i,mod)*cmb(n-1,n-i-1,mod)%mod
        ans %= mod
     i range(0,k+1) range 0 k+1 k 1 ans += cmb(n,i,mod)*cmb(n-1,n-i-1,mod)%mod ans cmb(n,i,mod)*cmb(n-1,n-i-1,mod)%mod cmb(n,i,mod)*cmb(n-1,n-i-1,mod) cmb(n,i,mod) cmb n i mod cmb(n-1,n-i-1,mod) cmb n-1 n 1 n-i-1 n-i n i 1 mod mod ans %= mod ans mod print(ans) print ans fact_inv = [0]*(m+5) [0]*(m+5) fact_inv inv = [0]*(m+5) [0]*(m+5) inv m = 4*10**5 4*10**5 m mod = 10**9 + 7 10**9 + 7 mod k = list(map(int, input().split())) list(map(int, input().split())) k ans = 0 0 ans def cmb(n,k,mod):
    return fact[n] * (fact_inv[k] * fact_inv[n-k] % mod) % mod def cmb(n,k,mod):
    return fact[n] * (fact_inv[k] * fact_inv[n-k] % mod) % mod cmb n,k = list(map(int, input().split())) list(map(int, input().split())) n fact = [0]*(m+5) [0]*(m+5) fact ans += cmb(n,i,mod)*cmb(n-1,n-i-1,mod)%mod cmb(n,i,mod)*cmb(n-1,n-i-1,mod)%mod ans ans %= mod mod ans
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq

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

# C,Pを求める前処理
m = 4*10**5
mod = 10**9 + 7


fact = [0]*(m+5)
fact_inv = [0]*(m+5)
inv = [0]*(m+5)

fact[0] = fact[1] = 1
fact_inv[0] = fact_inv[1] = 1
inv[1] = 1

for i in range(2,m+5):
    fact[i] = fact[i-1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod

# nCkをmod（素数）で割った余りを求める．ただしn<10**7
# 前処理はm=n+5まで
def cmb(n,k,mod):
    return fact[n] * (fact_inv[k] * fact_inv[n-k] % mod) % mod

if k >= n-1:
    print(cmb(2*n-1, n-1, mod)%mod)
else:
    ans = 0
    for i in range(0,k+1):
        ans += cmb(n,i,mod)*cmb(n-1,n-i-1,mod)%mod
        ans %= mod
    print(ans)




