import sys
sys.setrecursionlimit(10000000)
input=sys.stdin.readline
mod = 10 ** 9 + 7

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

fac = [1]*(n+1)
inv = [1]*(n+1)
for i in range(1,n+1):
  fac[i] = (fac[i-1]*i) % mod  
inv[n] = pow(fac[n], mod-2, mod)
for i in range(n, 0, -1):
  inv[i-1] = (inv[i]*i) % mod
    
def cmb(n, r):
  if r < 0 or r > n: return 0
  return (((fac[n] * inv[r])%mod) * inv[n-r]) % mod
 


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

print(ans%mod) import sys sys sys.setrecursionlimit(10000000) sys.setrecursionlimit sys setrecursionlimit 10000000 input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 n,k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k fac = [1]*(n+1) fac [1]*(n+1) [1] 1 n+1 n 1 inv = [1]*(n+1) inv [1]*(n+1) [1] 1 n+1 n 1 for i in range(1,n+1):
  fac[i] = (fac[i-1]*i) % mod   i range(1,n+1) range 1 n+1 n 1 fac[i] = (fac[i-1]*i) % mod fac[i] fac i (fac[i-1]*i) % mod fac[i-1]*i fac[i-1] fac i-1 i 1 i mod inv[n] = pow(fac[n], mod-2, mod) inv[n] inv n pow(fac[n], mod-2, mod) pow fac[n] fac n mod-2 mod 2 mod for i in range(n, 0, -1):
  inv[i-1] = (inv[i]*i) % mod
     i range(n, 0, -1) range n 0 -1 inv[i-1] = (inv[i]*i) % mod inv[i-1] inv i-1 i 1 (inv[i]*i) % mod inv[i]*i inv[i] inv i i mod def cmb(n, r):
  if r < 0 or r > n: return 0
  return (((fac[n] * inv[r])%mod) * inv[n-r]) % mod
  cmb if r < 0 or r > n: return 0
   r < 0 or r > n r < 0 r 0 r > n r n return (((fac[n] * inv[r])%mod) * inv[n-r]) % mod (((fac[n] * inv[r])%mod) * inv[n-r]) % mod ((fac[n] * inv[r])%mod) * inv[n-r] (fac[n] * inv[r])%mod fac[n] * inv[r] fac[n] fac n inv[r] inv r mod inv[n-r] inv n-r n r mod n n r r ans=0 ans 0 k=min(k,n-1) k min(k,n-1) min k n-1 n 1 for i in range(k+1):
    ans += cmb(n,i) * cmb(n-1,i) %mod i range(k+1) range k+1 k 1 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 print(ans%mod) print ans%mod ans mod ans=0 0 ans n,k = map(int,input().split()) map(int,input().split()) n mod = 10 ** 9 + 7 10 ** 9 + 7 mod def cmb(n, r):
  if r < 0 or r > n: return 0
  return (((fac[n] * inv[r])%mod) * inv[n-r]) % mod
  def cmb(n, r):
  if r < 0 or r > n: return 0
  return (((fac[n] * inv[r])%mod) * inv[n-r]) % mod
  cmb fac = [1]*(n+1) [1]*(n+1) fac inv = [1]*(n+1) [1]*(n+1) inv input=sys.stdin.readline sys.stdin.readline input k = map(int,input().split()) map(int,input().split()) k k=min(k,n-1) min(k,n-1) k ans += cmb(n,i) * cmb(n-1,i) %mod cmb(n,i) * cmb(n-1,i) %mod ans
import sys
sys.setrecursionlimit(10000000)
input=sys.stdin.readline
mod = 10 ** 9 + 7

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

fac = [1]*(n+1)
inv = [1]*(n+1)
for i in range(1,n+1):
  fac[i] = (fac[i-1]*i) % mod  
inv[n] = pow(fac[n], mod-2, mod)
for i in range(n, 0, -1):
  inv[i-1] = (inv[i]*i) % mod
    
def cmb(n, r):
  if r < 0 or r > n: return 0
  return (((fac[n] * inv[r])%mod) * inv[n-r]) % mod
 


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

print(ans%mod)
