#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,k=MI()
factmod=[1 for i in range(n+1)]
for i in range(n):
    factmod[i+1]=(factmod[i]*(i+1))%mod
#print(factmod)
ans=0
for m in range(min(k+1,n)):
    a=factmod[-1]*pow((factmod[m]*factmod[n-m])%mod,mod-2,mod)
    b=factmod[n-1]*pow((factmod[m]*factmod[n-m-1])%mod,mod-2,mod)
    ans=(ans+(a*b))%mod
print(ans%mod)

     import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 from collections import Counter, deque from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush from math import floor, ceil,pi,factorial from operator import itemgetter def I(): return int(input()) I def MI(): return map(int, input().split()) MI def LI(): return list(map(int, input().split())) LI int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input def LI2(): return [int(input()) for i in range(n)] LI2 [LI()]for i in range(n) for i in range(n) i range(n) range n for i in range(n) [LI()] LI() LI def MXI(): return [[LI()]for i in range(n)] MXI def SI(): return input().rstrip() SI def printns(x): print('\n'.join(x)) printns x x def printni(x): print('\n'.join(list(map(str,x)))) printni x x inf = 10**17 inf 10**17 10 17 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 n,k=MI() n MI() MI k 1 for i in range(n+1) for i in range(n+1) i range(n+1) range n+1 n 1 for i in range(n+1) 1 factmod=[1 for i in range(n+1)] factmod [1 for i in range(n+1)] for i in range(n):
    factmod[i+1]=(factmod[i]*(i+1))%mod
#print(factmod) i range(n) range n factmod[i+1]=(factmod[i]*(i+1))%mod factmod[i+1] factmod i+1 i 1 (factmod[i]*(i+1))%mod factmod[i]*(i+1) factmod[i] factmod i i+1 i 1 mod ans=0 ans 0 for m in range(min(k+1,n)):
    a=factmod[-1]*pow((factmod[m]*factmod[n-m])%mod,mod-2,mod)
    b=factmod[n-1]*pow((factmod[m]*factmod[n-m-1])%mod,mod-2,mod)
    ans=(ans+(a*b))%mod m range(min(k+1,n)) range min(k+1,n) min k+1 k 1 n a=factmod[-1]*pow((factmod[m]*factmod[n-m])%mod,mod-2,mod) a factmod[-1]*pow((factmod[m]*factmod[n-m])%mod,mod-2,mod) factmod[-1] factmod -1 pow((factmod[m]*factmod[n-m])%mod,mod-2,mod) pow (factmod[m]*factmod[n-m])%mod factmod[m]*factmod[n-m] factmod[m] factmod m factmod[n-m] factmod n-m n m mod mod-2 mod 2 mod b=factmod[n-1]*pow((factmod[m]*factmod[n-m-1])%mod,mod-2,mod) b factmod[n-1]*pow((factmod[m]*factmod[n-m-1])%mod,mod-2,mod) factmod[n-1] factmod n-1 n 1 pow((factmod[m]*factmod[n-m-1])%mod,mod-2,mod) pow (factmod[m]*factmod[n-m-1])%mod factmod[m]*factmod[n-m-1] factmod[m] factmod m factmod[n-m-1] factmod n-m-1 n-m n m 1 mod mod-2 mod 2 mod ans=(ans+(a*b))%mod ans (ans+(a*b))%mod ans+(a*b) ans a*b a b mod print(ans%mod) print ans%mod ans mod inf = 10**17 10**17 inf ans=(ans+(a*b))%mod (ans+(a*b))%mod ans def MI(): return map(int, input().split()) def MI(): return map(int, input().split()) MI def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI def SI(): return input().rstrip() def SI(): return input().rstrip() SI def printns(x): print('\n'.join(x)) def printns(x): print('\n'.join(x)) printns factmod=[1 for i in range(n+1)] [1 for i in range(n+1)] factmod mod = 10**9 + 7 10**9 + 7 mod a=factmod[-1]*pow((factmod[m]*factmod[n-m])%mod,mod-2,mod) factmod[-1]*pow((factmod[m]*factmod[n-m])%mod,mod-2,mod) a b=factmod[n-1]*pow((factmod[m]*factmod[n-m-1])%mod,mod-2,mod) factmod[n-1]*pow((factmod[m]*factmod[n-m-1])%mod,mod-2,mod) b n,k=MI() MI() n def printni(x): print('\n'.join(list(map(str,x)))) def printni(x): print('\n'.join(list(map(str,x)))) printni def LI2(): return [int(input()) for i in range(n)] def LI2(): return [int(input()) for i in range(n)] LI2 k=MI() MI() k ans=0 0 ans input = sys.stdin.readline sys.stdin.readline input def I(): return int(input()) def I(): return int(input()) I def MXI(): return [[LI()]for i in range(n)] def MXI(): return [[LI()]for i in range(n)] MXI
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,k=MI()
factmod=[1 for i in range(n+1)]
for i in range(n):
    factmod[i+1]=(factmod[i]*(i+1))%mod
#print(factmod)
ans=0
for m in range(min(k+1,n)):
    a=factmod[-1]*pow((factmod[m]*factmod[n-m])%mod,mod-2,mod)
    b=factmod[n-1]*pow((factmod[m]*factmod[n-m-1])%mod,mod-2,mod)
    ans=(ans+(a*b))%mod
print(ans%mod)

    
