def cmb(n, r):#コンビネーション(mod)の高速計算　
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 5*10**5 #Nの最大値
g1 = [0]*(N+1) #元テーブル(p(n,r))
g1[0] = g1[1] = 1
g2 = [0]*(N+1) #逆元テーブル
g2[0] = g2[1] = 1
inverse = [0]*(N+1) #逆元テーブル計算用テーブル
inverse[0],inverse[1] = 0,1
for i in range(2,N+1):
    g1[i] = (g1[i-1] * i) % mod
    inverse[i] = (-inverse[mod % i] * (mod//i)) % mod
    g2[i] = (g2[i-1] * inverse[i]) % mod

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

# 0の数がi個の場合の数
dp = [0]*(n+1)
# 残りn-i種類にi個を割り振る　×　0がi個の場合の数 -> n-1Ci * nCi
for i in range(n+1):
    dp[i] = cmb(n-1,i) * cmb(n,i) % mod

if k == 1:
    ans = dp[1]
else:
    k = min(n,k)
    ans = 0
    for i in range(k+1):
        ans += dp[i]
        ans %= mod
print(ans) def cmb(n, r):#コンビネーション(mod)の高速計算　
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod cmb if ( r<0 or r>n ):
        return 0
     r<0 or r>n r<0 r 0 r>n r n return 0 0 r = min(r, n-r) r min(r, n-r) min r n-r n r return g1[n] * g2[r] * g2[n-r] % mod g1[n] * g2[r] * g2[n-r] % mod g1[n] * g2[r] * g2[n-r] g1[n] * g2[r] g1[n] g1 n g2[r] g2 r g2[n-r] g2 n-r n r mod n n r r mod = 10**9+7 mod 10**9+7 10**9 10 9 7 N = 5*10**5 N 5*10**5 5 10**5 10 5 g1 = [0]*(N+1) g1 [0]*(N+1) [0] 0 N+1 N 1 g1[0] = g1[1] = 1 g1[0] g1 0 1 = g1[1] = 1 g1[1] g1 1 1 g2 = [0]*(N+1) g2 [0]*(N+1) [0] 0 N+1 N 1 g2[0] = g2[1] = 1 g2[0] g2 0 1 = g2[1] = 1 g2[1] g2 1 1 inverse = [0]*(N+1) inverse [0]*(N+1) [0] 0 N+1 N 1 inverse[0],inverse[1] = 0,1 inverse[0] inverse 0 0 inverse[1] inverse 1 1 for i in range(2,N+1):
    g1[i] = (g1[i-1] * i) % mod
    inverse[i] = (-inverse[mod % i] * (mod//i)) % mod
    g2[i] = (g2[i-1] * inverse[i]) % mod i range(2,N+1) range 2 N+1 N 1 g1[i] = (g1[i-1] * i) % mod g1[i] g1 i (g1[i-1] * i) % mod g1[i-1] * i g1[i-1] g1 i-1 i 1 i mod inverse[i] = (-inverse[mod % i] * (mod//i)) % mod inverse[i] inverse i (-inverse[mod % i] * (mod//i)) % mod -inverse[mod % i] * (mod//i) -inverse[mod % i] inverse[mod % i] inverse mod % i mod i mod//i mod i mod g2[i] = (g2[i-1] * inverse[i]) % mod g2[i] g2 i (g2[i-1] * inverse[i]) % mod g2[i-1] * inverse[i] g2[i-1] g2 i-1 i 1 inverse[i] inverse i mod n,k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k dp = [0]*(n+1) dp [0]*(n+1) [0] 0 n+1 n 1 for i in range(n+1):
    dp[i] = cmb(n-1,i) * cmb(n,i) % mod i range(n+1) range n+1 n 1 dp[i] = cmb(n-1,i) * cmb(n,i) % mod dp[i] dp i cmb(n-1,i) * cmb(n,i) % mod cmb(n-1,i) * cmb(n,i) cmb(n-1,i) cmb n-1 n 1 i cmb(n,i) cmb n i mod if k == 1:
    ans = dp[1]
else:
    k = min(n,k)
    ans = 0
    for i in range(k+1):
        ans += dp[i]
        ans %= mod k == 1 k 1 ans = dp[1] ans dp[1] dp 1 k = min(n,k) k min(n,k) min n k ans = 0 ans 0 for i in range(k+1):
        ans += dp[i]
        ans %= mod i range(k+1) range k+1 k 1 ans += dp[i] ans dp[i] dp i ans %= mod ans mod print(ans) print ans ans += dp[i] dp[i] ans ans %= mod mod ans inverse = [0]*(N+1) [0]*(N+1) inverse ans = 0 0 ans g2 = [0]*(N+1) [0]*(N+1) g2 k = min(n,k) min(n,k) k mod = 10**9+7 10**9+7 mod g1 = [0]*(N+1) [0]*(N+1) g1 ans = dp[1] dp[1] ans N = 5*10**5 5*10**5 N n,k = map(int,input().split()) map(int,input().split()) n dp = [0]*(n+1) [0]*(n+1) dp def cmb(n, r):#コンビネーション(mod)の高速計算　
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod def cmb(n, r):#コンビネーション(mod)の高速計算　
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod cmb k = map(int,input().split()) map(int,input().split()) k
def cmb(n, r):#コンビネーション(mod)の高速計算　
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 5*10**5 #Nの最大値
g1 = [0]*(N+1) #元テーブル(p(n,r))
g1[0] = g1[1] = 1
g2 = [0]*(N+1) #逆元テーブル
g2[0] = g2[1] = 1
inverse = [0]*(N+1) #逆元テーブル計算用テーブル
inverse[0],inverse[1] = 0,1
for i in range(2,N+1):
    g1[i] = (g1[i-1] * i) % mod
    inverse[i] = (-inverse[mod % i] * (mod//i)) % mod
    g2[i] = (g2[i-1] * inverse[i]) % mod

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

# 0の数がi個の場合の数
dp = [0]*(n+1)
# 残りn-i種類にi個を割り振る　×　0がi個の場合の数 -> n-1Ci * nCi
for i in range(n+1):
    dp[i] = cmb(n-1,i) * cmb(n,i) % mod

if k == 1:
    ans = dp[1]
else:
    k = min(n,k)
    ans = 0
    for i in range(k+1):
        ans += dp[i]
        ans %= mod
print(ans)