n, k = map(int, input().split())
if n - 1 < k:
    k = n-1
mod = 10**9+7
cmb1 = [1]*(n+1)
cmb2 = [1]*n
x = [0]*(n+1)
def Pow(a, n):
    if n == 0: return 1
    if n%2 == 0:
        return (Pow(a, n//2))**2%mod
    else:
        return Pow(a, n-1)*a%mod
for i in range(1,n+1):
    x[i] = Pow(i, mod-2)
for i in range(1,n+1):
    cmb1[i] = cmb1[i-1]*(n+1-i)%mod*x[i]%mod
for i in range(1,n):
    cmb2[i] = cmb2[i-1]*(n-i)%mod*x[i]%mod
ans = 0    
for i in range(k+1):
    ans = ((cmb1[i]*cmb2[i])%mod + ans)%mod
print(ans) n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k if n - 1 < k:
    k = n-1 n - 1 < k n - 1 n 1 k k = n-1 k n-1 n 1 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 cmb1 = [1]*(n+1) cmb1 [1]*(n+1) [1] 1 n+1 n 1 cmb2 = [1]*n cmb2 [1]*n [1] 1 n x = [0]*(n+1) x [0]*(n+1) [0] 0 n+1 n 1 def Pow(a, n):
    if n == 0: return 1
    if n%2 == 0:
        return (Pow(a, n//2))**2%mod
    else:
        return Pow(a, n-1)*a%mod Pow if n == 0: return 1
     n == 0 n 0 if n%2 == 0:
        return (Pow(a, n//2))**2%mod
    else:
        return Pow(a, n-1)*a%mod n%2 == 0 n%2 n 2 0 return (Pow(a, n//2))**2%mod (Pow(a, n//2))**2%mod (Pow(a, n//2))**2 Pow(a, n//2) Pow a n//2 n 2 2 mod return Pow(a, n-1)*a%mod Pow(a, n-1)*a%mod Pow(a, n-1)*a Pow(a, n-1) Pow a n-1 n 1 a mod a a n n for i in range(1,n+1):
    x[i] = Pow(i, mod-2) i range(1,n+1) range 1 n+1 n 1 x[i] = Pow(i, mod-2) x[i] x i Pow(i, mod-2) Pow i mod-2 mod 2 for i in range(1,n+1):
    cmb1[i] = cmb1[i-1]*(n+1-i)%mod*x[i]%mod i range(1,n+1) range 1 n+1 n 1 cmb1[i] = cmb1[i-1]*(n+1-i)%mod*x[i]%mod cmb1[i] cmb1 i cmb1[i-1]*(n+1-i)%mod*x[i]%mod cmb1[i-1]*(n+1-i)%mod*x[i] cmb1[i-1]*(n+1-i)%mod cmb1[i-1]*(n+1-i) cmb1[i-1] cmb1 i-1 i 1 n+1-i n+1 n 1 i mod x[i] x i mod for i in range(1,n):
    cmb2[i] = cmb2[i-1]*(n-i)%mod*x[i]%mod i range(1,n) range 1 n cmb2[i] = cmb2[i-1]*(n-i)%mod*x[i]%mod cmb2[i] cmb2 i cmb2[i-1]*(n-i)%mod*x[i]%mod cmb2[i-1]*(n-i)%mod*x[i] cmb2[i-1]*(n-i)%mod cmb2[i-1]*(n-i) cmb2[i-1] cmb2 i-1 i 1 n-i n i mod x[i] x i mod ans = 0 ans 0 for i in range(k+1):
    ans = ((cmb1[i]*cmb2[i])%mod + ans)%mod i range(k+1) range k+1 k 1 ans = ((cmb1[i]*cmb2[i])%mod + ans)%mod ans ((cmb1[i]*cmb2[i])%mod + ans)%mod (cmb1[i]*cmb2[i])%mod + ans (cmb1[i]*cmb2[i])%mod cmb1[i]*cmb2[i] cmb1[i] cmb1 i cmb2[i] cmb2 i mod ans mod print(ans) print ans k = map(int, input().split()) map(int, input().split()) k mod = 10**9+7 10**9+7 mod x = [0]*(n+1) [0]*(n+1) x n, k = map(int, input().split()) map(int, input().split()) n k = n-1 n-1 k def Pow(a, n):
    if n == 0: return 1
    if n%2 == 0:
        return (Pow(a, n//2))**2%mod
    else:
        return Pow(a, n-1)*a%mod def Pow(a, n):
    if n == 0: return 1
    if n%2 == 0:
        return (Pow(a, n//2))**2%mod
    else:
        return Pow(a, n-1)*a%mod Pow ans = 0 0 ans cmb2 = [1]*n [1]*n cmb2 ans = ((cmb1[i]*cmb2[i])%mod + ans)%mod ((cmb1[i]*cmb2[i])%mod + ans)%mod ans cmb1 = [1]*(n+1) [1]*(n+1) cmb1
n, k = map(int, input().split())
if n - 1 < k:
    k = n-1
mod = 10**9+7
cmb1 = [1]*(n+1)
cmb2 = [1]*n
x = [0]*(n+1)
def Pow(a, n):
    if n == 0: return 1
    if n%2 == 0:
        return (Pow(a, n//2))**2%mod
    else:
        return Pow(a, n-1)*a%mod
for i in range(1,n+1):
    x[i] = Pow(i, mod-2)
for i in range(1,n+1):
    cmb1[i] = cmb1[i-1]*(n+1-i)%mod*x[i]%mod
for i in range(1,n):
    cmb2[i] = cmb2[i-1]*(n-i)%mod*x[i]%mod
ans = 0    
for i in range(k+1):
    ans = ((cmb1[i]*cmb2[i])%mod + ans)%mod
print(ans)