def inv(a,m=10**9+7):
    b=m
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return lastx % m

mod=10**9+7
n,k=map(int,input().split())
k=min(k,n-1)
frac=[1]
for i in range(1,n+1):
    frac.append(frac[-1]*i%mod)

ans=0
for i in range(k+1):
    tmp=inv(frac[i]**2%mod*frac[n-i]*frac[n-1-i]%mod)
    ans+=tmp
    ans%=mod
ans=ans*frac[n]*frac[n-1]%mod
print(ans) def inv(a,m=10**9+7):
    b=m
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return lastx % m inv b=m b m (x, lastx) = (0, 1) (x, lastx) x lastx (0, 1) 0 1 (y, lasty) = (1, 0) (y, lasty) y lasty (1, 0) 1 0 while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
     b != 0 b 0 q = a // b q a // b a b (a, b) = (b, a % b) (a, b) a b (b, a % b) b a % b a b (x, lastx) = (lastx - q * x, x) (x, lastx) x lastx (lastx - q * x, x) lastx - q * x lastx q * x q x x (y, lasty) = (lasty - q * y, y) (y, lasty) y lasty (lasty - q * y, y) lasty - q * y lasty q * y q y y return lastx % m lastx % m lastx m a a m=10**9+7 m 10**9+7 10**9 10 9 7 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 k=min(k,n-1) k min(k,n-1) min k n-1 n 1 frac=[1] frac [1] 1 for i in range(1,n+1):
    frac.append(frac[-1]*i%mod) i range(1,n+1) range 1 n+1 n 1 frac.append(frac[-1]*i%mod) frac.append frac append frac[-1]*i%mod frac[-1]*i frac[-1] frac -1 i mod ans=0 ans 0 for i in range(k+1):
    tmp=inv(frac[i]**2%mod*frac[n-i]*frac[n-1-i]%mod)
    ans+=tmp
    ans%=mod i range(k+1) range k+1 k 1 tmp=inv(frac[i]**2%mod*frac[n-i]*frac[n-1-i]%mod) tmp inv(frac[i]**2%mod*frac[n-i]*frac[n-1-i]%mod) inv frac[i]**2%mod*frac[n-i]*frac[n-1-i]%mod frac[i]**2%mod*frac[n-i]*frac[n-1-i] frac[i]**2%mod*frac[n-i] frac[i]**2%mod frac[i]**2 frac[i] frac i 2 mod frac[n-i] frac n-i n i frac[n-1-i] frac n-1-i n-1 n 1 i mod ans+=tmp ans tmp ans%=mod ans mod ans=ans*frac[n]*frac[n-1]%mod ans ans*frac[n]*frac[n-1]%mod ans*frac[n]*frac[n-1] ans*frac[n] ans frac[n] frac n frac[n-1] frac n-1 n 1 mod print(ans) print ans tmp=inv(frac[i]**2%mod*frac[n-i]*frac[n-1-i]%mod) inv(frac[i]**2%mod*frac[n-i]*frac[n-1-i]%mod) tmp mod=10**9+7 10**9+7 mod ans=0 0 ans ans+=tmp tmp ans k=min(k,n-1) min(k,n-1) k n,k=map(int,input().split()) map(int,input().split()) n ans%=mod mod ans def inv(a,m=10**9+7):
    b=m
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return lastx % m def inv(a,m=10**9+7):
    b=m
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return lastx % m inv ans=ans*frac[n]*frac[n-1]%mod ans*frac[n]*frac[n-1]%mod ans frac=[1] [1] frac k=map(int,input().split()) map(int,input().split()) k
def inv(a,m=10**9+7):
    b=m
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return lastx % m

mod=10**9+7
n,k=map(int,input().split())
k=min(k,n-1)
frac=[1]
for i in range(1,n+1):
    frac.append(frac[-1]*i%mod)

ans=0
for i in range(k+1):
    tmp=inv(frac[i]**2%mod*frac[n-i]*frac[n-1-i]%mod)
    ans+=tmp
    ans%=mod
ans=ans*frac[n]*frac[n-1]%mod
print(ans)