MOD=10**9+7
def facinv(N):
    fac,finv,inv=[0]*(N+1),[0]*(N+1),[0]*(N+1)#階乗テーブル、逆元テーブル、逆元
    fac[0]=1;fac[1]=1;finv[0]=1;finv[1]=1;inv[1]=1
    for i in range(2,N+1):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
    return fac,finv,inv


def COM(n,r):
    if n<r or r<0:
        return 0
    else:
        return ((fac[n]*finv[r])%MOD*finv[n-r])%MOD
        
n,k=map(int,input().split())
fac,finv,inv=facinv(2*n)

if k>=n-1:
    print(COM(2*n-1,n-1))
else:
    ans=COM(2*n-1,n-1)
    for i in range(1,n-k):
        ans=(ans-COM(n,i)*COM(n-1,i-1)%MOD+MOD)%MOD
    print(ans%MOD) MOD=10**9+7 MOD 10**9+7 10**9 10 9 7 def facinv(N):
    fac,finv,inv=[0]*(N+1),[0]*(N+1),[0]*(N+1)#階乗テーブル、逆元テーブル、逆元
    fac[0]=1;fac[1]=1;finv[0]=1;finv[1]=1;inv[1]=1
    for i in range(2,N+1):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
    return fac,finv,inv facinv fac,finv,inv=[0]*(N+1),[0]*(N+1),[0]*(N+1) fac [0]*(N+1) [0] 0 N+1 N 1 finv [0]*(N+1) [0] 0 N+1 N 1 inv [0]*(N+1) [0] 0 N+1 N 1 fac[0]=1 fac[0] fac 0 1 fac[1]=1 fac[1] fac 1 1 finv[0]=1 finv[0] finv 0 1 finv[1]=1 finv[1] finv 1 1 inv[1]=1 inv[1] inv 1 1 for i in range(2,N+1):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
     i range(2,N+1) range 2 N+1 N 1 fac[i]=fac[i-1]*i%MOD fac[i] fac i fac[i-1]*i%MOD fac[i-1]*i fac[i-1] fac 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 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 return fac,finv,inv return fac,finv,inv fac finv inv N N def COM(n,r):
    if n<r or r<0:
        return 0
    else:
        return ((fac[n]*finv[r])%MOD*finv[n-r])%MOD
         COM if n<r or r<0:
        return 0
    else:
        return ((fac[n]*finv[r])%MOD*finv[n-r])%MOD
         n<r or r<0 n<r n r r<0 r 0 return 0 0 return ((fac[n]*finv[r])%MOD*finv[n-r])%MOD ((fac[n]*finv[r])%MOD*finv[n-r])%MOD (fac[n]*finv[r])%MOD*finv[n-r] (fac[n]*finv[r])%MOD fac[n]*finv[r] fac[n] fac n finv[r] finv r MOD finv[n-r] finv n-r n r MOD n n r r n,k=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k fac,finv,inv=facinv(2*n) fac facinv(2*n) facinv 2*n 2 n finv inv if k>=n-1:
    print(COM(2*n-1,n-1))
else:
    ans=COM(2*n-1,n-1)
    for i in range(1,n-k):
        ans=(ans-COM(n,i)*COM(n-1,i-1)%MOD+MOD)%MOD
    print(ans%MOD) k>=n-1 k n-1 n 1 print(COM(2*n-1,n-1)) print COM(2*n-1,n-1) COM 2*n-1 2*n 2 n 1 n-1 n 1 ans=COM(2*n-1,n-1) ans COM(2*n-1,n-1) COM 2*n-1 2*n 2 n 1 n-1 n 1 for i in range(1,n-k):
        ans=(ans-COM(n,i)*COM(n-1,i-1)%MOD+MOD)%MOD
     i range(1,n-k) range 1 n-k n k ans=(ans-COM(n,i)*COM(n-1,i-1)%MOD+MOD)%MOD ans (ans-COM(n,i)*COM(n-1,i-1)%MOD+MOD)%MOD ans-COM(n,i)*COM(n-1,i-1)%MOD+MOD ans-COM(n,i)*COM(n-1,i-1)%MOD ans COM(n,i)*COM(n-1,i-1)%MOD COM(n,i)*COM(n-1,i-1) COM(n,i) COM n i COM(n-1,i-1) COM n-1 n 1 i-1 i 1 MOD MOD MOD print(ans%MOD) print ans%MOD ans MOD k=map(int,input().split()) map(int,input().split()) k finv,inv=facinv(2*n) facinv(2*n) finv def facinv(N):
    fac,finv,inv=[0]*(N+1),[0]*(N+1),[0]*(N+1)#階乗テーブル、逆元テーブル、逆元
    fac[0]=1;fac[1]=1;finv[0]=1;finv[1]=1;inv[1]=1
    for i in range(2,N+1):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
    return fac,finv,inv def facinv(N):
    fac,finv,inv=[0]*(N+1),[0]*(N+1),[0]*(N+1)#階乗テーブル、逆元テーブル、逆元
    fac[0]=1;fac[1]=1;finv[0]=1;finv[1]=1;inv[1]=1
    for i in range(2,N+1):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
    return fac,finv,inv facinv n,k=map(int,input().split()) map(int,input().split()) n MOD=10**9+7 10**9+7 MOD fac,finv,inv=facinv(2*n) facinv(2*n) fac ans=(ans-COM(n,i)*COM(n-1,i-1)%MOD+MOD)%MOD (ans-COM(n,i)*COM(n-1,i-1)%MOD+MOD)%MOD ans inv=facinv(2*n) facinv(2*n) inv def COM(n,r):
    if n<r or r<0:
        return 0
    else:
        return ((fac[n]*finv[r])%MOD*finv[n-r])%MOD
         def COM(n,r):
    if n<r or r<0:
        return 0
    else:
        return ((fac[n]*finv[r])%MOD*finv[n-r])%MOD
         COM ans=COM(2*n-1,n-1) COM(2*n-1,n-1) ans
MOD=10**9+7
def facinv(N):
    fac,finv,inv=[0]*(N+1),[0]*(N+1),[0]*(N+1)#階乗テーブル、逆元テーブル、逆元
    fac[0]=1;fac[1]=1;finv[0]=1;finv[1]=1;inv[1]=1
    for i in range(2,N+1):
        fac[i]=fac[i-1]*i%MOD
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        finv[i]=finv[i-1]*inv[i]%MOD
    return fac,finv,inv


def COM(n,r):
    if n<r or r<0:
        return 0
    else:
        return ((fac[n]*finv[r])%MOD*finv[n-r])%MOD
        
n,k=map(int,input().split())
fac,finv,inv=facinv(2*n)

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