MAX = 10 ** 5 * 2
mod = 10 ** 9 + 7
frac = [1]
inv_frac=[1]
def pow(a, n):
    if n == 0 : return  1
    elif n == 1 : return a
    tmp = pow(a, n//2)
    tmp = (tmp * tmp) % mod
    if n % 2 == 1 :
        tmp = (tmp * a) % mod
    return tmp
def inv(x):
    return pow(x, mod - 2 )
for i in range(1,MAX + 1 ):
    frac.append( (frac[-1] * i) % mod )
    inv_frac.append(inv(frac[-1])%mod)
def comb(n, k):
    if k >= n or k < 0 : return 1
    return (frac[n]*inv_frac[n-k] * inv_frac[k]) %mod
n,k = map(int,input().split())
count=0
b=inv(n)
for i in range(min(n,k+1)):
    a=comb(n,i)
    count=(count+a*a*(n-i)*b)%mod
print(count) MAX = 10 ** 5 * 2 MAX 10 ** 5 * 2 10 ** 5 10 5 2 mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 frac = [1] frac [1] 1 inv_frac=[1] inv_frac [1] 1 def pow(a, n):
    if n == 0 : return  1
    elif n == 1 : return a
    tmp = pow(a, n//2)
    tmp = (tmp * tmp) % mod
    if n % 2 == 1 :
        tmp = (tmp * a) % mod
    return tmp pow if n == 0 : return  1
    elif n == 1 : return a
     n == 0 n 0 elif n == 1 : return a
     n == 1 n 1 tmp = pow(a, n//2) tmp pow(a, n//2) pow a n//2 n 2 tmp = (tmp * tmp) % mod tmp (tmp * tmp) % mod tmp * tmp tmp tmp mod if n % 2 == 1 :
        tmp = (tmp * a) % mod
     n % 2 == 1 n % 2 n 2 1 tmp = (tmp * a) % mod tmp (tmp * a) % mod tmp * a tmp a mod return tmp tmp a a n n def inv(x):
    return pow(x, mod - 2 ) inv return pow(x, mod - 2 ) pow(x, mod - 2 ) pow x mod - 2 mod 2 x x for i in range(1,MAX + 1 ):
    frac.append( (frac[-1] * i) % mod )
    inv_frac.append(inv(frac[-1])%mod) i range(1,MAX + 1 ) range 1 MAX + 1 MAX 1 frac.append( (frac[-1] * i) % mod ) frac.append frac append (frac[-1] * i) % mod frac[-1] * i frac[-1] frac -1 i mod inv_frac.append(inv(frac[-1])%mod) inv_frac.append inv_frac append inv(frac[-1])%mod inv(frac[-1]) inv frac[-1] frac -1 mod def comb(n, k):
    if k >= n or k < 0 : return 1
    return (frac[n]*inv_frac[n-k] * inv_frac[k]) %mod comb if k >= n or k < 0 : return 1
     k >= n or k < 0 k >= n k n k < 0 k 0 return (frac[n]*inv_frac[n-k] * inv_frac[k]) %mod (frac[n]*inv_frac[n-k] * inv_frac[k]) %mod frac[n]*inv_frac[n-k] * inv_frac[k] frac[n]*inv_frac[n-k] frac[n] frac n inv_frac[n-k] inv_frac n-k n k inv_frac[k] inv_frac k mod n n k k n,k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k count=0 count 0 b=inv(n) b inv(n) inv n for i in range(min(n,k+1)):
    a=comb(n,i)
    count=(count+a*a*(n-i)*b)%mod i range(min(n,k+1)) range min(n,k+1) min n k+1 k 1 a=comb(n,i) a comb(n,i) comb n i count=(count+a*a*(n-i)*b)%mod count (count+a*a*(n-i)*b)%mod count+a*a*(n-i)*b count a*a*(n-i)*b a*a*(n-i) a*a a a n-i n i b mod print(count) print count def inv(x):
    return pow(x, mod - 2 ) def inv(x):
    return pow(x, mod - 2 ) inv count=(count+a*a*(n-i)*b)%mod (count+a*a*(n-i)*b)%mod count def pow(a, n):
    if n == 0 : return  1
    elif n == 1 : return a
    tmp = pow(a, n//2)
    tmp = (tmp * tmp) % mod
    if n % 2 == 1 :
        tmp = (tmp * a) % mod
    return tmp def pow(a, n):
    if n == 0 : return  1
    elif n == 1 : return a
    tmp = pow(a, n//2)
    tmp = (tmp * tmp) % mod
    if n % 2 == 1 :
        tmp = (tmp * a) % mod
    return tmp pow inv_frac=[1] [1] inv_frac n,k = map(int,input().split()) map(int,input().split()) n a=comb(n,i) comb(n,i) a MAX = 10 ** 5 * 2 10 ** 5 * 2 MAX def comb(n, k):
    if k >= n or k < 0 : return 1
    return (frac[n]*inv_frac[n-k] * inv_frac[k]) %mod def comb(n, k):
    if k >= n or k < 0 : return 1
    return (frac[n]*inv_frac[n-k] * inv_frac[k]) %mod comb count=0 0 count mod = 10 ** 9 + 7 10 ** 9 + 7 mod frac = [1] [1] frac b=inv(n) inv(n) b k = map(int,input().split()) map(int,input().split()) k
MAX = 10 ** 5 * 2
mod = 10 ** 9 + 7
frac = [1]
inv_frac=[1]
def pow(a, n):
    if n == 0 : return  1
    elif n == 1 : return a
    tmp = pow(a, n//2)
    tmp = (tmp * tmp) % mod
    if n % 2 == 1 :
        tmp = (tmp * a) % mod
    return tmp
def inv(x):
    return pow(x, mod - 2 )
for i in range(1,MAX + 1 ):
    frac.append( (frac[-1] * i) % mod )
    inv_frac.append(inv(frac[-1])%mod)
def comb(n, k):
    if k >= n or k < 0 : return 1
    return (frac[n]*inv_frac[n-k] * inv_frac[k]) %mod
n,k = map(int,input().split())
count=0
b=inv(n)
for i in range(min(n,k+1)):
    a=comb(n,i)
    count=(count+a*a*(n-i)*b)%mod
print(count)