def comb(n, r):
    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
MAXN=400000+10
g1=[1, 1]
g2=[1, 1]
inverse=[0, 1]

for i in range(2, MAXN+1):
    g1.append((g1[-1]*i)%MOD)
    inverse.append(-inverse[MOD%i]*(MOD//i)%MOD)
    g2.append((g2[-1]*inverse[-1])%MOD)

N, K=map(int, input().split())
if K>=N-1:
    print(comb(N*2-1, N))
else:
    ans=1
    for i in range(1, K+1):
        ans=(ans+(comb(N-1, i)*comb(N, i))%MOD)%MOD
    print(ans) def comb(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    return g1[n]*g2[r]*g2[n-r]%MOD comb 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 MAXN=400000+10 MAXN 400000+10 400000 10 g1=[1, 1] g1 [1, 1] 1 1 g2=[1, 1] g2 [1, 1] 1 1 inverse=[0, 1] inverse [0, 1] 0 1 for i in range(2, MAXN+1):
    g1.append((g1[-1]*i)%MOD)
    inverse.append(-inverse[MOD%i]*(MOD//i)%MOD)
    g2.append((g2[-1]*inverse[-1])%MOD) i range(2, MAXN+1) range 2 MAXN+1 MAXN 1 g1.append((g1[-1]*i)%MOD) g1.append g1 append (g1[-1]*i)%MOD g1[-1]*i g1[-1] g1 -1 i MOD inverse.append(-inverse[MOD%i]*(MOD//i)%MOD) inverse.append inverse append -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.append((g2[-1]*inverse[-1])%MOD) g2.append g2 append (g2[-1]*inverse[-1])%MOD g2[-1]*inverse[-1] g2[-1] g2 -1 inverse[-1] inverse -1 MOD N, K=map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K if K>=N-1:
    print(comb(N*2-1, N))
else:
    ans=1
    for i in range(1, K+1):
        ans=(ans+(comb(N-1, i)*comb(N, i))%MOD)%MOD
    print(ans) K>=N-1 K N-1 N 1 print(comb(N*2-1, N)) print comb(N*2-1, N) comb N*2-1 N*2 N 2 1 N ans=1 ans 1 for i in range(1, K+1):
        ans=(ans+(comb(N-1, i)*comb(N, i))%MOD)%MOD
     i range(1, K+1) range 1 K+1 K 1 ans=(ans+(comb(N-1, i)*comb(N, i))%MOD)%MOD ans (ans+(comb(N-1, i)*comb(N, i))%MOD)%MOD ans+(comb(N-1, i)*comb(N, i))%MOD ans (comb(N-1, i)*comb(N, i))%MOD comb(N-1, i)*comb(N, i) comb(N-1, i) comb N-1 N 1 i comb(N, i) comb N i MOD MOD print(ans) print ans g2=[1, 1] [1, 1] g2 inverse=[0, 1] [0, 1] inverse K=map(int, input().split()) map(int, input().split()) K N, K=map(int, input().split()) map(int, input().split()) N MAXN=400000+10 400000+10 MAXN MOD=10**9+7 10**9+7 MOD def comb(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    return g1[n]*g2[r]*g2[n-r]%MOD def comb(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    return g1[n]*g2[r]*g2[n-r]%MOD comb g1=[1, 1] [1, 1] g1 ans=1 1 ans ans=(ans+(comb(N-1, i)*comb(N, i))%MOD)%MOD (ans+(comb(N-1, i)*comb(N, i))%MOD)%MOD ans
def comb(n, r):
    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
MAXN=400000+10
g1=[1, 1]
g2=[1, 1]
inverse=[0, 1]

for i in range(2, MAXN+1):
    g1.append((g1[-1]*i)%MOD)
    inverse.append(-inverse[MOD%i]*(MOD//i)%MOD)
    g2.append((g2[-1]*inverse[-1])%MOD)

N, K=map(int, input().split())
if K>=N-1:
    print(comb(N*2-1, N))
else:
    ans=1
    for i in range(1, K+1):
        ans=(ans+(comb(N-1, i)*comb(N, i))%MOD)%MOD
    print(ans)
