n,k = list(map(int, input().split()))
mod = int(1e9+7)



def init_cmb(Nmax):
    #mod = 10**9+7 #出力の制限
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] # 逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

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

g1,g2 = init_cmb(n+10)

def cmb(n, r, modn=mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % modn
  
# ci = 0 である個数が m となるような数列の数は、 nCm ×n−m Hm = nCm * n-1Cn-m-1
# 0 <= m < n で足算する

ans = 0
for i in range(min(k+1,n)):
  wk = cmb(n,i) * cmb(n-1, n-i-1) % mod
  ans = (ans + wk ) % mod
  
print(ans) n,k = list(map(int, input().split())) n list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k mod = int(1e9+7) mod int(1e9+7) int 1e9+7 1e9 7 def init_cmb(Nmax):
    #mod = 10**9+7 #出力の制限
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] # 逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

    for i in range(2, Nmax + 1):
        g1.append((g1[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)
    return g1, g2 init_cmb 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, Nmax + 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, Nmax + 1) range 2 Nmax + 1 Nmax 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 return g1, g2 return g1, g2 g1 g2 Nmax Nmax g1,g2 = init_cmb(n+10) g1 init_cmb(n+10) init_cmb n+10 n 10 g2 def cmb(n, r, modn=mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % modn
  
# ci = 0 である個数が m となるような数列の数は、 nCm ×n−m Hm = nCm * n-1Cn-m-1
# 0 <= m < n で足算する cmb 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] % modn g1[n] * g2[r] * g2[n-r] % modn 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 modn n n r r modn=mod modn mod ans = 0 ans 0 for i in range(min(k+1,n)):
  wk = cmb(n,i) * cmb(n-1, n-i-1) % mod
  ans = (ans + wk ) % mod
   i range(min(k+1,n)) range min(k+1,n) min k+1 k 1 n wk = cmb(n,i) * cmb(n-1, n-i-1) % mod wk cmb(n,i) * cmb(n-1, n-i-1) % mod cmb(n,i) * cmb(n-1, n-i-1) cmb(n,i) cmb n i cmb(n-1, n-i-1) cmb n-1 n 1 n-i-1 n-i n i 1 mod ans = (ans + wk ) % mod ans (ans + wk ) % mod ans + wk ans wk mod print(ans) print ans wk = cmb(n,i) * cmb(n-1, n-i-1) % mod cmb(n,i) * cmb(n-1, n-i-1) % mod wk mod = int(1e9+7) int(1e9+7) mod g1,g2 = init_cmb(n+10) init_cmb(n+10) g1 ans = (ans + wk ) % mod (ans + wk ) % mod ans n,k = list(map(int, input().split())) list(map(int, input().split())) n k = list(map(int, input().split())) list(map(int, input().split())) k def init_cmb(Nmax):
    #mod = 10**9+7 #出力の制限
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] # 逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

    for i in range(2, Nmax + 1):
        g1.append((g1[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)
    return g1, g2 def init_cmb(Nmax):
    #mod = 10**9+7 #出力の制限
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] # 逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

    for i in range(2, Nmax + 1):
        g1.append((g1[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)
    return g1, g2 init_cmb ans = 0 0 ans g2 = init_cmb(n+10) init_cmb(n+10) g2 def cmb(n, r, modn=mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % modn
  
# ci = 0 である個数が m となるような数列の数は、 nCm ×n−m Hm = nCm * n-1Cn-m-1
# 0 <= m < n で足算する def cmb(n, r, modn=mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % modn
  
# ci = 0 である個数が m となるような数列の数は、 nCm ×n−m Hm = nCm * n-1Cn-m-1
# 0 <= m < n で足算する cmb
n,k = list(map(int, input().split()))
mod = int(1e9+7)



def init_cmb(Nmax):
    #mod = 10**9+7 #出力の制限
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] # 逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

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

g1,g2 = init_cmb(n+10)

def cmb(n, r, modn=mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % modn
  
# ci = 0 である個数が m となるような数列の数は、 nCm ×n−m Hm = nCm * n-1Cn-m-1
# 0 <= m < n で足算する

ans = 0
for i in range(min(k+1,n)):
  wk = cmb(n,i) * cmb(n-1, n-i-1) % mod
  ans = (ans + wk ) % mod
  
print(ans)