from sys import stdin
#入力
readline=stdin.readline
N,K=map(int,readline().split())

mod=10**9+7
fact=[1]*(2*N)
finv=[1]*(2*N)
inv=[1]*(2*N)
inv[0]=0
for i in range(2,2*N):
    fact[i]=(fact[i-1]*i%mod)
    inv[i]=(-inv[mod%i]*(mod//i))%mod
    finv[i]=(finv[i-1]*inv[i])%mod

def com(N,K,mod):
    if (K<0) or (N<K):
        return 0
    return fact[N]*finv[K]*finv[N-K]%mod

if N-1<=K:
    print(com(2*N-1,N,mod))

else:
    res=0
    for m in range(K+1):
        res+=com(N,m,mod)*com(N-1,m,mod)
        res%=mod
    print(res) from sys import stdin readline=stdin.readline readline stdin.readline stdin readline N,K=map(int,readline().split()) N map(int,readline().split()) map int readline().split() ().split () readline split K mod=10**9+7 mod 10**9+7 10**9 10 9 7 fact=[1]*(2*N) fact [1]*(2*N) [1] 1 2*N 2 N finv=[1]*(2*N) finv [1]*(2*N) [1] 1 2*N 2 N inv=[1]*(2*N) inv [1]*(2*N) [1] 1 2*N 2 N inv[0]=0 inv[0] inv 0 0 for i in range(2,2*N):
    fact[i]=(fact[i-1]*i%mod)
    inv[i]=(-inv[mod%i]*(mod//i))%mod
    finv[i]=(finv[i-1]*inv[i])%mod i range(2,2*N) range 2 2*N 2 N 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]=(-inv[mod%i]*(mod//i))%mod inv[i] inv i (-inv[mod%i]*(mod//i))%mod -inv[mod%i]*(mod//i) -inv[mod%i] inv[mod%i] inv mod%i mod i mod//i mod i mod finv[i]=(finv[i-1]*inv[i])%mod finv[i] finv i (finv[i-1]*inv[i])%mod finv[i-1]*inv[i] finv[i-1] finv i-1 i 1 inv[i] inv i mod def com(N,K,mod):
    if (K<0) or (N<K):
        return 0
    return fact[N]*finv[K]*finv[N-K]%mod com if (K<0) or (N<K):
        return 0
     (K<0) or (N<K) K<0 K 0 N<K N K return 0 0 return fact[N]*finv[K]*finv[N-K]%mod fact[N]*finv[K]*finv[N-K]%mod fact[N]*finv[K]*finv[N-K] fact[N]*finv[K] fact[N] fact N finv[K] finv K finv[N-K] finv N-K N K mod N N K K mod mod if N-1<=K:
    print(com(2*N-1,N,mod))

else:
    res=0
    for m in range(K+1):
        res+=com(N,m,mod)*com(N-1,m,mod)
        res%=mod
    print(res) N-1<=K N-1 N 1 K print(com(2*N-1,N,mod)) print com(2*N-1,N,mod) com 2*N-1 2*N 2 N 1 N mod res=0 res 0 for m in range(K+1):
        res+=com(N,m,mod)*com(N-1,m,mod)
        res%=mod
     m range(K+1) range K+1 K 1 res+=com(N,m,mod)*com(N-1,m,mod) res com(N,m,mod)*com(N-1,m,mod) com(N,m,mod) com N m mod com(N-1,m,mod) com N-1 N 1 m mod res%=mod res mod print(res) print res mod=10**9+7 10**9+7 mod inv=[1]*(2*N) [1]*(2*N) inv def com(N,K,mod):
    if (K<0) or (N<K):
        return 0
    return fact[N]*finv[K]*finv[N-K]%mod def com(N,K,mod):
    if (K<0) or (N<K):
        return 0
    return fact[N]*finv[K]*finv[N-K]%mod com finv=[1]*(2*N) [1]*(2*N) finv res%=mod mod res res=0 0 res N,K=map(int,readline().split()) map(int,readline().split()) N res+=com(N,m,mod)*com(N-1,m,mod) com(N,m,mod)*com(N-1,m,mod) res fact=[1]*(2*N) [1]*(2*N) fact readline=stdin.readline stdin.readline readline K=map(int,readline().split()) map(int,readline().split()) K
from sys import stdin
#入力
readline=stdin.readline
N,K=map(int,readline().split())

mod=10**9+7
fact=[1]*(2*N)
finv=[1]*(2*N)
inv=[1]*(2*N)
inv[0]=0
for i in range(2,2*N):
    fact[i]=(fact[i-1]*i%mod)
    inv[i]=(-inv[mod%i]*(mod//i))%mod
    finv[i]=(finv[i-1]*inv[i])%mod

def com(N,K,mod):
    if (K<0) or (N<K):
        return 0
    return fact[N]*finv[K]*finv[N-K]%mod

if N-1<=K:
    print(com(2*N-1,N,mod))

else:
    res=0
    for m in range(K+1):
        res+=com(N,m,mod)*com(N-1,m,mod)
        res%=mod
    print(res)