import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9+7

#nCrは以下のやつ全てを使ってください
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]
 
gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]
 
def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

def nPr(n,r):
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

N,K = map(int,input().split())
if K >= N:
    M = N
else:
    M = K

ans = 0
for i in range(1,M+1):
    ans += nCr(N,i) * nCr(N-1,i)
    ans %= MOD
print(ans+1) import bisect bisect import collections collections import copy copy import functools functools import heapq heapq import math math import sys sys from collections import deque from collections import defaultdict input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 kaijo_memo = [] kaijo_memo [] def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]
  kaijo if(len(kaijo_memo) > n):
    return kaijo_memo[n]
   len(kaijo_memo) > n len(kaijo_memo) len kaijo_memo n return kaijo_memo[n] kaijo_memo[n] kaijo_memo n if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
   len(kaijo_memo) == 0 len(kaijo_memo) len kaijo_memo 0 kaijo_memo.append(1) kaijo_memo.append kaijo_memo append 1 while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
   len(kaijo_memo) <= n len(kaijo_memo) len kaijo_memo n kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD) kaijo_memo.append kaijo_memo append kaijo_memo[-1] * len(kaijo_memo) % MOD kaijo_memo[-1] * len(kaijo_memo) kaijo_memo[-1] kaijo_memo -1 len(kaijo_memo) len kaijo_memo MOD return kaijo_memo[n] kaijo_memo[n] kaijo_memo n n n gyaku_kaijo_memo = [] gyaku_kaijo_memo [] def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]
  gyaku_kaijo if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
   len(gyaku_kaijo_memo) > n len(gyaku_kaijo_memo) len gyaku_kaijo_memo n return gyaku_kaijo_memo[n] gyaku_kaijo_memo[n] gyaku_kaijo_memo n if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
   len(gyaku_kaijo_memo) == 0 len(gyaku_kaijo_memo) len gyaku_kaijo_memo 0 gyaku_kaijo_memo.append(1) gyaku_kaijo_memo.append gyaku_kaijo_memo append 1 while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
   len(gyaku_kaijo_memo) <= n len(gyaku_kaijo_memo) len gyaku_kaijo_memo n gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD) gyaku_kaijo_memo.append gyaku_kaijo_memo append gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) gyaku_kaijo_memo[-1] gyaku_kaijo_memo -1 pow(len(gyaku_kaijo_memo),MOD-2,MOD) pow len(gyaku_kaijo_memo) len gyaku_kaijo_memo MOD-2 MOD 2 MOD MOD return gyaku_kaijo_memo[n] gyaku_kaijo_memo[n] gyaku_kaijo_memo n n n def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret nCr if(n == r):
    return 1
   n == r n r return 1 1 if(n < r or r < 0):
    return 0
   n < r or r < 0 n < r n r r < 0 r 0 return 0 0 ret = 1 ret 1 ret = ret * kaijo(n) % MOD ret ret * kaijo(n) % MOD ret * kaijo(n) ret kaijo(n) kaijo n MOD ret = ret * gyaku_kaijo(r) % MOD ret ret * gyaku_kaijo(r) % MOD ret * gyaku_kaijo(r) ret gyaku_kaijo(r) gyaku_kaijo r MOD ret = ret * gyaku_kaijo(n-r) % MOD ret ret * gyaku_kaijo(n-r) % MOD ret * gyaku_kaijo(n-r) ret gyaku_kaijo(n-r) gyaku_kaijo n-r n r MOD return ret ret n n r r def nPr(n,r):
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret nPr if(n < r or r < 0):
    return 0
   n < r or r < 0 n < r n r r < 0 r 0 return 0 0 ret = 1 ret 1 ret = ret * kaijo(n) % MOD ret ret * kaijo(n) % MOD ret * kaijo(n) ret kaijo(n) kaijo n MOD ret = ret * gyaku_kaijo(n-r) % MOD ret ret * gyaku_kaijo(n-r) % MOD ret * gyaku_kaijo(n-r) ret gyaku_kaijo(n-r) gyaku_kaijo n-r n r MOD return ret ret n n r r N,K = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split K if K >= N:
    M = N
else:
    M = K K >= N K N M = N M N M = K M K ans = 0 ans 0 for i in range(1,M+1):
    ans += nCr(N,i) * nCr(N-1,i)
    ans %= MOD i range(1,M+1) range 1 M+1 M 1 ans += nCr(N,i) * nCr(N-1,i) ans nCr(N,i) * nCr(N-1,i) nCr(N,i) nCr N i nCr(N-1,i) nCr N-1 N 1 i ans %= MOD ans MOD print(ans+1) print ans+1 ans 1 gyaku_kaijo_memo = [] [] gyaku_kaijo_memo M = K K M N,K = map(int,input().split()) map(int,input().split()) N ans = 0 0 ans ans %= MOD MOD ans def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]
  def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]
  kaijo M = N N M K = map(int,input().split()) map(int,input().split()) K input = sys.stdin.readline sys.stdin.readline input kaijo_memo = [] [] kaijo_memo def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]
  def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]
  gyaku_kaijo def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret nCr def nPr(n,r):
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret def nPr(n,r):
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret nPr MOD = 10**9+7 10**9+7 MOD ans += nCr(N,i) * nCr(N-1,i) nCr(N,i) * nCr(N-1,i) ans
import bisect
import collections
import copy
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
MOD = 10**9+7

#nCrは以下のやつ全てを使ってください
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]
 
gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]
 
def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

def nPr(n,r):
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

N,K = map(int,input().split())
if K >= N:
    M = N
else:
    M = K

ans = 0
for i in range(1,M+1):
    ans += nCr(N,i) * nCr(N-1,i)
    ans %= MOD
print(ans+1)