N,K=map(int, input().split())
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
n= 2*10 ** 5  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p) 階乗のmod
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, n + 1):
  fact.append((fact[-1] * i) % p)
  inv.append((-inv[p % i] * (p // i)) % p)
  factinv.append((factinv[-1] * inv[-1]) % p)


#0の数
zeros=min(K, N-1)
ans=1
for i in range(1,zeros+1):
    ans+=(cmb(N,i,p)*cmb(i+N-i-1, i, p))%p
    #print(pow(N-i, i, p))
    ans%=p

print(ans) N,K=map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p cmb if (r < 0) or (n < r):
        return 0
     (r < 0) or (n < r) r < 0 r 0 n < r n r return 0 0 r = min(r, n - r) r min(r, n - r) min r n - r n r return fact[n] * factinv[r] * factinv[n-r] % p fact[n] * factinv[r] * factinv[n-r] % p fact[n] * factinv[r] * factinv[n-r] fact[n] * factinv[r] fact[n] fact n factinv[r] factinv r factinv[n-r] factinv n-r n r p n n r r p p p = 10 ** 9 + 7 p 10 ** 9 + 7 10 ** 9 10 9 7 n= 2*10 ** 5 n 2*10 ** 5 2 10 ** 5 10 5 fact = [1, 1] fact [1, 1] 1 1 factinv = [1, 1] factinv [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 for i in range(2, n + 1):
  fact.append((fact[-1] * i) % p)
  inv.append((-inv[p % i] * (p // i)) % p)
  factinv.append((factinv[-1] * inv[-1]) % p)


#0の数 i range(2, n + 1) range 2 n + 1 n 1 fact.append((fact[-1] * i) % p) fact.append fact append (fact[-1] * i) % p fact[-1] * i fact[-1] fact -1 i p inv.append((-inv[p % i] * (p // i)) % p) inv.append inv append (-inv[p % i] * (p // i)) % p -inv[p % i] * (p // i) -inv[p % i] inv[p % i] inv p % i p i p // i p i p factinv.append((factinv[-1] * inv[-1]) % p) factinv.append factinv append (factinv[-1] * inv[-1]) % p factinv[-1] * inv[-1] factinv[-1] factinv -1 inv[-1] inv -1 p zeros=min(K, N-1) zeros min(K, N-1) min K N-1 N 1 ans=1 ans 1 for i in range(1,zeros+1):
    ans+=(cmb(N,i,p)*cmb(i+N-i-1, i, p))%p
    #print(pow(N-i, i, p))
    ans%=p i range(1,zeros+1) range 1 zeros+1 zeros 1 ans+=(cmb(N,i,p)*cmb(i+N-i-1, i, p))%p ans (cmb(N,i,p)*cmb(i+N-i-1, i, p))%p cmb(N,i,p)*cmb(i+N-i-1, i, p) cmb(N,i,p) cmb N i p cmb(i+N-i-1, i, p) cmb i+N-i-1 i+N-i i+N i N i 1 i p p ans%=p ans p print(ans) print ans zeros=min(K, N-1) min(K, N-1) zeros ans+=(cmb(N,i,p)*cmb(i+N-i-1, i, p))%p (cmb(N,i,p)*cmb(i+N-i-1, i, p))%p ans factinv = [1, 1] [1, 1] factinv inv = [0, 1] [0, 1] inv N,K=map(int, input().split()) map(int, input().split()) N n= 2*10 ** 5 2*10 ** 5 n K=map(int, input().split()) map(int, input().split()) K p = 10 ** 9 + 7 10 ** 9 + 7 p fact = [1, 1] [1, 1] fact ans=1 1 ans def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p cmb ans%=p p ans
N,K=map(int, input().split())
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
n= 2*10 ** 5  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p) 階乗のmod
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, n + 1):
  fact.append((fact[-1] * i) % p)
  inv.append((-inv[p % i] * (p // i)) % p)
  factinv.append((factinv[-1] * inv[-1]) % p)


#0の数
zeros=min(K, N-1)
ans=1
for i in range(1,zeros+1):
    ans+=(cmb(N,i,p)*cmb(i+N-i-1, i, p))%p
    #print(pow(N-i, i, p))
    ans%=p

print(ans)