n, k = map(int, input().split())

mod = 10 ** 9 + 7
N = 10 ** 6

#逆元テーブル
inv_t = [0]+[1]
for i in range(2, N):
  inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]

#階乗計算
kai = [1, 1]
rev_kai = [1, inv_t[1]]
for i in range(2, N):
	kai.append(kai[-1] * i % mod)
	rev_kai.append(rev_kai[-1] * inv_t[i] % mod)

# コンビネーション計算
def cmb(n, r):
	return kai[n] * rev_kai[r] * rev_kai[n-r] % mod

ans = 0
for i in range(0, min(k+1, n)):
    ans += cmb(n, i) * cmb(n-1, 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 mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 N = 10 ** 6 N 10 ** 6 10 6 inv_t = [0]+[1] inv_t [0]+[1] [0] 0 [1] 1 for i in range(2, N):
  inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]

#階乗計算 i range(2, N) range 2 N inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod] inv_t [inv_t[mod % i] * (mod - int(mod / i)) % mod] inv_t[mod % i] * (mod - int(mod / i)) % mod inv_t[mod % i] * (mod - int(mod / i)) inv_t[mod % i] inv_t mod % i mod i mod - int(mod / i) mod int(mod / i) int mod / i mod i mod kai = [1, 1] kai [1, 1] 1 1 rev_kai = [1, inv_t[1]] rev_kai [1, inv_t[1]] 1 inv_t[1] inv_t 1 for i in range(2, N):
	kai.append(kai[-1] * i % mod)
	rev_kai.append(rev_kai[-1] * inv_t[i] % mod)

# コンビネーション計算 i range(2, N) range 2 N kai.append(kai[-1] * i % mod) kai.append kai append kai[-1] * i % mod kai[-1] * i kai[-1] kai -1 i mod rev_kai.append(rev_kai[-1] * inv_t[i] % mod) rev_kai.append rev_kai append rev_kai[-1] * inv_t[i] % mod rev_kai[-1] * inv_t[i] rev_kai[-1] rev_kai -1 inv_t[i] inv_t i mod def cmb(n, r):
	return kai[n] * rev_kai[r] * rev_kai[n-r] % mod cmb return kai[n] * rev_kai[r] * rev_kai[n-r] % mod kai[n] * rev_kai[r] * rev_kai[n-r] % mod kai[n] * rev_kai[r] * rev_kai[n-r] kai[n] * rev_kai[r] kai[n] kai n rev_kai[r] rev_kai r rev_kai[n-r] rev_kai n-r n r mod n n r r ans = 0 ans 0 for i in range(0, min(k+1, n)):
    ans += cmb(n, i) * cmb(n-1, i) % mod
    ans %= mod i range(0, min(k+1, n)) range 0 min(k+1, n) min k+1 k 1 n ans += cmb(n, i) * cmb(n-1, i) % mod ans cmb(n, i) * cmb(n-1, i) % mod cmb(n, i) * cmb(n-1, i) cmb(n, i) cmb n i cmb(n-1, i) cmb n-1 n 1 i mod ans %= mod ans mod print(ans) print ans N = 10 ** 6 10 ** 6 N inv_t = [0]+[1] [0]+[1] inv_t inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod] [inv_t[mod % i] * (mod - int(mod / i)) % mod] inv_t rev_kai = [1, inv_t[1]] [1, inv_t[1]] rev_kai ans += cmb(n, i) * cmb(n-1, i) % mod cmb(n, i) * cmb(n-1, i) % mod ans n, k = map(int, input().split()) map(int, input().split()) n k = map(int, input().split()) map(int, input().split()) k mod = 10 ** 9 + 7 10 ** 9 + 7 mod kai = [1, 1] [1, 1] kai ans = 0 0 ans def cmb(n, r):
	return kai[n] * rev_kai[r] * rev_kai[n-r] % mod def cmb(n, r):
	return kai[n] * rev_kai[r] * rev_kai[n-r] % mod cmb ans %= mod mod ans
n, k = map(int, input().split())

mod = 10 ** 9 + 7
N = 10 ** 6

#逆元テーブル
inv_t = [0]+[1]
for i in range(2, N):
  inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]

#階乗計算
kai = [1, 1]
rev_kai = [1, inv_t[1]]
for i in range(2, N):
	kai.append(kai[-1] * i % mod)
	rev_kai.append(rev_kai[-1] * inv_t[i] % mod)

# コンビネーション計算
def cmb(n, r):
	return kai[n] * rev_kai[r] * rev_kai[n-r] % mod

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