import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 10**9+7
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    #2n-1Cn

    fac1=1
    fac2=1
    facs=[1,1]
    for i in range(2,2*N):
        facs.append(facs[-1]*i%mod)

    # fac1=pow(facs[N],mod-2,mod)
    # fac2=pow(facs[N-1],mod-2,mod)
    # tot=facs[2*N-1]*fac1%mod
    # tot*=fac2
    # tot%=mod
    def comb(N,r):
        fac1=pow(facs[r],mod-2,mod)
        fac2=pow(facs[N-r],mod-2,mod)
        tot=(facs[N]*fac1%mod)*fac2%mod
        return tot
    tot=comb(2*N-1,N)
    if N-1<=K:
        print(tot)
    
    
    else:#0のへやがk+1より多くあるとボツ
        r=0
        for i in range(1,N-(K+1)+1):
            n=N-i
            r+=comb(N,i)*comb(n+i-1,i-1)%mod
            r%=mod
        print((tot-r)%mod)





if __name__ == "__main__":
    main() import sys sys sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 import math math from copy import copy, deepcopy from operator import itemgetter from bisect import bisect_left, bisect, bisect_right from collections import deque from collections import Counter from itertools import accumulate from heapq import heapify,heappop,heappush from functools import lru_cache def input(): return sys.stdin.readline()[:-1] input def printl(li): print(*li, sep="\n") printl li li def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds argsort inds=sorted(range(len(s)), key=lambda k: s[k]) inds sorted(range(len(s)), key=lambda k: s[k]) sorted range(len(s)) range len(s) len s key=lambda k: s[k] key lambda k: s[k] s[k] s k k s[i] for i in inds for i in inds i inds for i in inds s[i] s i if return_sorted: return inds, [s[i] for i in inds]
     return_sorted return inds inds s s return_sorted=False return_sorted False def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65 alp2num c c cap=False cap False def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65) num2alp i i cap=False cap False def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)] matmat K,N,M=len(B),len(A),len(B[0]) K len(B) len B N len(A) len A M len(B[0]) len B[0] B 0 [sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N) for i in range(N) i range(N) range N for i in range(N) [sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)] [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)] A A B B def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)] matvec N,size=len(v),len(M) N len(v) len v size len(M) len M sum([M[i][j]*v[j] for j in range(N)]) for i in range(size) for i in range(size) i range(size) range size for i in range(size) sum([M[i][j]*v[j] for j in range(N)]) sum [M[i][j]*v[j] for j in range(N)] return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)] [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)] M M v v def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)] T n,m=len(M),len(M[0]) n len(M) len M m len(M[0]) len M[0] M 0 [M[j][i] for j in range(n)] for i in range(m) for i in range(m) i range(m) range m for i in range(m) [M[j][i] for j in range(n)] return [[M[j][i] for j in range(n)] for i in range(m)] [[M[j][i] for j in range(n)] for i in range(m)] M M def main():
    mod = 10**9+7
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    #2n-1Cn

    fac1=1
    fac2=1
    facs=[1,1]
    for i in range(2,2*N):
        facs.append(facs[-1]*i%mod)

    # fac1=pow(facs[N],mod-2,mod)
    # fac2=pow(facs[N-1],mod-2,mod)
    # tot=facs[2*N-1]*fac1%mod
    # tot*=fac2
    # tot%=mod
    def comb(N,r):
        fac1=pow(facs[r],mod-2,mod)
        fac2=pow(facs[N-r],mod-2,mod)
        tot=(facs[N]*fac1%mod)*fac2%mod
        return tot
    tot=comb(2*N-1,N)
    if N-1<=K:
        print(tot)
    
    
    else:#0のへやがk+1より多くあるとボツ
        r=0
        for i in range(1,N-(K+1)+1):
            n=N-i
            r+=comb(N,i)*comb(n+i-1,i-1)%mod
            r%=mod
        print((tot-r)%mod) main mod = 10**9+7 mod 10**9+7 10**9 10 9 7 N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K fac1=1 fac1 1 fac2=1 fac2 1 facs=[1,1] facs [1,1] 1 1 for i in range(2,2*N):
        facs.append(facs[-1]*i%mod)

    # fac1=pow(facs[N],mod-2,mod)
    # fac2=pow(facs[N-1],mod-2,mod)
    # tot=facs[2*N-1]*fac1%mod
    # tot*=fac2
    # tot%=mod
     i range(2,2*N) range 2 2*N 2 N facs.append(facs[-1]*i%mod) facs.append facs append facs[-1]*i%mod facs[-1]*i facs[-1] facs -1 i mod def comb(N,r):
        fac1=pow(facs[r],mod-2,mod)
        fac2=pow(facs[N-r],mod-2,mod)
        tot=(facs[N]*fac1%mod)*fac2%mod
        return tot
     comb fac1=pow(facs[r],mod-2,mod) fac1 pow(facs[r],mod-2,mod) pow facs[r] facs r mod-2 mod 2 mod fac2=pow(facs[N-r],mod-2,mod) fac2 pow(facs[N-r],mod-2,mod) pow facs[N-r] facs N-r N r mod-2 mod 2 mod tot=(facs[N]*fac1%mod)*fac2%mod tot (facs[N]*fac1%mod)*fac2%mod (facs[N]*fac1%mod)*fac2 facs[N]*fac1%mod facs[N]*fac1 facs[N] facs N fac1 mod fac2 mod return tot tot N N r r tot=comb(2*N-1,N) tot comb(2*N-1,N) comb 2*N-1 2*N 2 N 1 N if N-1<=K:
        print(tot)
    
    
    else:#0のへやがk+1より多くあるとボツ
        r=0
        for i in range(1,N-(K+1)+1):
            n=N-i
            r+=comb(N,i)*comb(n+i-1,i-1)%mod
            r%=mod
        print((tot-r)%mod) N-1<=K N-1 N 1 K print(tot) print tot r=0 r 0 for i in range(1,N-(K+1)+1):
            n=N-i
            r+=comb(N,i)*comb(n+i-1,i-1)%mod
            r%=mod
         i range(1,N-(K+1)+1) range 1 N-(K+1)+1 N-(K+1) N K+1 K 1 1 n=N-i n N-i N i r+=comb(N,i)*comb(n+i-1,i-1)%mod r comb(N,i)*comb(n+i-1,i-1)%mod comb(N,i)*comb(n+i-1,i-1) comb(N,i) comb N i comb(n+i-1,i-1) comb n+i-1 n+i n i 1 i-1 i 1 mod r%=mod r mod print((tot-r)%mod) print (tot-r)%mod tot-r tot r mod if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65) def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65) num2alp def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65 def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65 alp2num def main():
    mod = 10**9+7
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    #2n-1Cn

    fac1=1
    fac2=1
    facs=[1,1]
    for i in range(2,2*N):
        facs.append(facs[-1]*i%mod)

    # fac1=pow(facs[N],mod-2,mod)
    # fac2=pow(facs[N-1],mod-2,mod)
    # tot=facs[2*N-1]*fac1%mod
    # tot*=fac2
    # tot%=mod
    def comb(N,r):
        fac1=pow(facs[r],mod-2,mod)
        fac2=pow(facs[N-r],mod-2,mod)
        tot=(facs[N]*fac1%mod)*fac2%mod
        return tot
    tot=comb(2*N-1,N)
    if N-1<=K:
        print(tot)
    
    
    else:#0のへやがk+1より多くあるとボツ
        r=0
        for i in range(1,N-(K+1)+1):
            n=N-i
            r+=comb(N,i)*comb(n+i-1,i-1)%mod
            r%=mod
        print((tot-r)%mod) def main():
    mod = 10**9+7
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    #2n-1Cn

    fac1=1
    fac2=1
    facs=[1,1]
    for i in range(2,2*N):
        facs.append(facs[-1]*i%mod)

    # fac1=pow(facs[N],mod-2,mod)
    # fac2=pow(facs[N-1],mod-2,mod)
    # tot=facs[2*N-1]*fac1%mod
    # tot*=fac2
    # tot%=mod
    def comb(N,r):
        fac1=pow(facs[r],mod-2,mod)
        fac2=pow(facs[N-r],mod-2,mod)
        tot=(facs[N]*fac1%mod)*fac2%mod
        return tot
    tot=comb(2*N-1,N)
    if N-1<=K:
        print(tot)
    
    
    else:#0のへやがk+1より多くあるとボツ
        r=0
        for i in range(1,N-(K+1)+1):
            n=N-i
            r+=comb(N,i)*comb(n+i-1,i-1)%mod
            r%=mod
        print((tot-r)%mod) main def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)] def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)] matmat def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)] def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)] matvec def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)] def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)] T def input(): return sys.stdin.readline()[:-1] def input(): return sys.stdin.readline()[:-1] input def printl(li): print(*li, sep="\n") def printl(li): print(*li, sep="\n") printl def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds argsort
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 10**9+7
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    #2n-1Cn

    fac1=1
    fac2=1
    facs=[1,1]
    for i in range(2,2*N):
        facs.append(facs[-1]*i%mod)

    # fac1=pow(facs[N],mod-2,mod)
    # fac2=pow(facs[N-1],mod-2,mod)
    # tot=facs[2*N-1]*fac1%mod
    # tot*=fac2
    # tot%=mod
    def comb(N,r):
        fac1=pow(facs[r],mod-2,mod)
        fac2=pow(facs[N-r],mod-2,mod)
        tot=(facs[N]*fac1%mod)*fac2%mod
        return tot
    tot=comb(2*N-1,N)
    if N-1<=K:
        print(tot)
    
    
    else:#0のへやがk+1より多くあるとボツ
        r=0
        for i in range(1,N-(K+1)+1):
            n=N-i
            r+=comb(N,i)*comb(n+i-1,i-1)%mod
            r%=mod
        print((tot-r)%mod)





if __name__ == "__main__":
    main()