import sys
input = sys.stdin.readline
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+2  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
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)

def solve():
  n,k = (int(i) for i in input().split())
  mod = 10**9+7
  if n-k <= 1:
    #任意の部屋に移動可能
    comba = 1
    inva = 1
    for i in range(1,n+1):
      comba *= (n+i-1)
      inva *= i
      comba %= mod
      inva %= mod
    comba *= pow(inva,10**9+5,mod)
    comba %= mod
    print(comba)
  else:
    #n <= 2**10^5
    #k <= 2**10^5
    ans = 0
    
    
    
    for i in range(0,k+1):
      ans += cmb(n,i,mod)*cmb(n-1,i,mod)
      ans %= mod
    
    print(ans)
  
solve() import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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+2 N 2* 10 ** 5+2 2* 10 ** 5 2 10 ** 5 10 5 2 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) 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 def solve():
  n,k = (int(i) for i in input().split())
  mod = 10**9+7
  if n-k <= 1:
    #任意の部屋に移動可能
    comba = 1
    inva = 1
    for i in range(1,n+1):
      comba *= (n+i-1)
      inva *= i
      comba %= mod
      inva %= mod
    comba *= pow(inva,10**9+5,mod)
    comba %= mod
    print(comba)
  else:
    #n <= 2**10^5
    #k <= 2**10^5
    ans = 0
    
    
    
    for i in range(0,k+1):
      ans += cmb(n,i,mod)*cmb(n-1,i,mod)
      ans %= mod
    
    print(ans)
   solve int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i n,k = (int(i) for i in input().split()) n (int(i) for i in input().split()) k mod = 10**9+7 mod 10**9+7 10**9 10 9 7 if n-k <= 1:
    #任意の部屋に移動可能
    comba = 1
    inva = 1
    for i in range(1,n+1):
      comba *= (n+i-1)
      inva *= i
      comba %= mod
      inva %= mod
    comba *= pow(inva,10**9+5,mod)
    comba %= mod
    print(comba)
  else:
    #n <= 2**10^5
    #k <= 2**10^5
    ans = 0
    
    
    
    for i in range(0,k+1):
      ans += cmb(n,i,mod)*cmb(n-1,i,mod)
      ans %= mod
    
    print(ans)
   n-k <= 1 n-k n k 1 comba = 1 comba 1 inva = 1 inva 1 for i in range(1,n+1):
      comba *= (n+i-1)
      inva *= i
      comba %= mod
      inva %= mod
     i range(1,n+1) range 1 n+1 n 1 comba *= (n+i-1) comba n+i-1 n+i n i 1 inva *= i inva i comba %= mod comba mod inva %= mod inva mod comba *= pow(inva,10**9+5,mod) comba pow(inva,10**9+5,mod) pow inva 10**9+5 10**9 10 9 5 mod comba %= mod comba mod print(comba) print comba ans = 0 ans 0 for i in range(0,k+1):
      ans += cmb(n,i,mod)*cmb(n-1,i,mod)
      ans %= mod
    
     i range(0,k+1) range 0 k+1 k 1 ans += cmb(n,i,mod)*cmb(n-1,i,mod) ans cmb(n,i,mod)*cmb(n-1,i,mod) cmb(n,i,mod) cmb n i mod cmb(n-1,i,mod) cmb n-1 n 1 i mod ans %= mod ans mod print(ans) print ans solve() solve input = sys.stdin.readline sys.stdin.readline input 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 N = 2* 10 ** 5+2 2* 10 ** 5+2 N p = 10 ** 9 + 7 10 ** 9 + 7 p fact = [1, 1] [1, 1] fact def solve():
  n,k = (int(i) for i in input().split())
  mod = 10**9+7
  if n-k <= 1:
    #任意の部屋に移動可能
    comba = 1
    inva = 1
    for i in range(1,n+1):
      comba *= (n+i-1)
      inva *= i
      comba %= mod
      inva %= mod
    comba *= pow(inva,10**9+5,mod)
    comba %= mod
    print(comba)
  else:
    #n <= 2**10^5
    #k <= 2**10^5
    ans = 0
    
    
    
    for i in range(0,k+1):
      ans += cmb(n,i,mod)*cmb(n-1,i,mod)
      ans %= mod
    
    print(ans)
   def solve():
  n,k = (int(i) for i in input().split())
  mod = 10**9+7
  if n-k <= 1:
    #任意の部屋に移動可能
    comba = 1
    inva = 1
    for i in range(1,n+1):
      comba *= (n+i-1)
      inva *= i
      comba %= mod
      inva %= mod
    comba *= pow(inva,10**9+5,mod)
    comba %= mod
    print(comba)
  else:
    #n <= 2**10^5
    #k <= 2**10^5
    ans = 0
    
    
    
    for i in range(0,k+1):
      ans += cmb(n,i,mod)*cmb(n-1,i,mod)
      ans %= mod
    
    print(ans)
   solve factinv = [1, 1] [1, 1] factinv inv = [0, 1] [0, 1] inv
import sys
input = sys.stdin.readline
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+2  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
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)

def solve():
  n,k = (int(i) for i in input().split())
  mod = 10**9+7
  if n-k <= 1:
    #任意の部屋に移動可能
    comba = 1
    inva = 1
    for i in range(1,n+1):
      comba *= (n+i-1)
      inva *= i
      comba %= mod
      inva %= mod
    comba *= pow(inva,10**9+5,mod)
    comba %= mod
    print(comba)
  else:
    #n <= 2**10^5
    #k <= 2**10^5
    ans = 0
    
    
    
    for i in range(0,k+1):
      ans += cmb(n,i,mod)*cmb(n-1,i,mod)
      ans %= mod
    
    print(ans)
  
solve()