#coding:utf-8
class Combination:
    def __init__(self,N,P=10**9+7):
        if N > 10**7:
            self.fact = lambda x: x * self.fact(x-1) % P if x > 2 else 2
            self.perm = lambda x, r: x * self.perm(x-1,r-1) % P if r > 0 else 1
            self.cmb = lambda n,r: (self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P) if r > 0 else 1
        else:
            self.__fact = [1] * (N+1)
            self.__inv = [1] * (N+1)
            self.__inv_fact = [1] * (N+1)
            for i in range(2,N+1):
                self.__fact[i] = self.__fact[i-1] * i % P
                self.__inv[i] = - self.__inv[P%i] * (P//i) % P
                self.__inv_fact[i] = self.__inv_fact[i-1] * self.__inv[i] % P
            self.fact = lambda n: self.__fact[n]
            self.perm = lambda n,r: self.__fact[n] * self.__inv_fact[n-r] % P
            self.cmb = lambda n,r: (self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P) if r > 0 else 1






import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7
    from collections import deque
    
    n,k = LMIIS()
    cmb = Combination(2*n)
    ans = 1
    for i in range(1,min(n,k+1)):
        ans = (ans + cmb.cmb(n,i) * cmb.cmb(n-1,i)) % MOD
    print(ans)

    
if __name__ == '__main__':
    main() class Combination:
    def __init__(self,N,P=10**9+7):
        if N > 10**7:
            self.fact = lambda x: x * self.fact(x-1) % P if x > 2 else 2
            self.perm = lambda x, r: x * self.perm(x-1,r-1) % P if r > 0 else 1
            self.cmb = lambda n,r: (self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P) if r > 0 else 1
        else:
            self.__fact = [1] * (N+1)
            self.__inv = [1] * (N+1)
            self.__inv_fact = [1] * (N+1)
            for i in range(2,N+1):
                self.__fact[i] = self.__fact[i-1] * i % P
                self.__inv[i] = - self.__inv[P%i] * (P//i) % P
                self.__inv_fact[i] = self.__inv_fact[i-1] * self.__inv[i] % P
            self.fact = lambda n: self.__fact[n]
            self.perm = lambda n,r: self.__fact[n] * self.__inv_fact[n-r] % P
            self.cmb = lambda n,r: (self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P) if r > 0 else 1 Combination def __init__(self,N,P=10**9+7):
        if N > 10**7:
            self.fact = lambda x: x * self.fact(x-1) % P if x > 2 else 2
            self.perm = lambda x, r: x * self.perm(x-1,r-1) % P if r > 0 else 1
            self.cmb = lambda n,r: (self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P) if r > 0 else 1
        else:
            self.__fact = [1] * (N+1)
            self.__inv = [1] * (N+1)
            self.__inv_fact = [1] * (N+1)
            for i in range(2,N+1):
                self.__fact[i] = self.__fact[i-1] * i % P
                self.__inv[i] = - self.__inv[P%i] * (P//i) % P
                self.__inv_fact[i] = self.__inv_fact[i-1] * self.__inv[i] % P
            self.fact = lambda n: self.__fact[n]
            self.perm = lambda n,r: self.__fact[n] * self.__inv_fact[n-r] % P
            self.cmb = lambda n,r: (self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P) if r > 0 else 1 __init__ if N > 10**7:
            self.fact = lambda x: x * self.fact(x-1) % P if x > 2 else 2
            self.perm = lambda x, r: x * self.perm(x-1,r-1) % P if r > 0 else 1
            self.cmb = lambda n,r: (self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P) if r > 0 else 1
        else:
            self.__fact = [1] * (N+1)
            self.__inv = [1] * (N+1)
            self.__inv_fact = [1] * (N+1)
            for i in range(2,N+1):
                self.__fact[i] = self.__fact[i-1] * i % P
                self.__inv[i] = - self.__inv[P%i] * (P//i) % P
                self.__inv_fact[i] = self.__inv_fact[i-1] * self.__inv[i] % P
            self.fact = lambda n: self.__fact[n]
            self.perm = lambda n,r: self.__fact[n] * self.__inv_fact[n-r] % P
            self.cmb = lambda n,r: (self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P) if r > 0 else 1 N > 10**7 N 10**7 10 7 self.fact = lambda x: x * self.fact(x-1) % P if x > 2 else 2 self.fact self fact lambda x: x * self.fact(x-1) % P if x > 2 else 2 x * self.fact(x-1) % P if x > 2 else 2 x > 2 x 2 x * self.fact(x-1) % P x * self.fact(x-1) x self.fact(x-1) self.fact self fact x-1 x 1 P 2 x self.perm = lambda x, r: x * self.perm(x-1,r-1) % P if r > 0 else 1 self.perm self perm lambda x, r: x * self.perm(x-1,r-1) % P if r > 0 else 1 x * self.perm(x-1,r-1) % P if r > 0 else 1 r > 0 r 0 x * self.perm(x-1,r-1) % P x * self.perm(x-1,r-1) x self.perm(x-1,r-1) self.perm self perm x-1 x 1 r-1 r 1 P 1 x r self.cmb = lambda n,r: (self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P) if r > 0 else 1 self.cmb self cmb lambda n,r: (self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P) if r > 0 else 1 (self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P) if r > 0 else 1 r > 0 r 0 self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) self.perm(n,min(n-r,r)) self.perm self perm n min(n-r,r) min n-r n r r pow(self.fact(min(n-r,r)) ,P-2 ,P) pow self.fact(min(n-r,r)) self.fact self fact min(n-r,r) min n-r n r r P-2 P 2 P P 1 n r self.__fact = [1] * (N+1) self.__fact self __fact [1] * (N+1) [1] 1 N+1 N 1 self.__inv = [1] * (N+1) self.__inv self __inv [1] * (N+1) [1] 1 N+1 N 1 self.__inv_fact = [1] * (N+1) self.__inv_fact self __inv_fact [1] * (N+1) [1] 1 N+1 N 1 for i in range(2,N+1):
                self.__fact[i] = self.__fact[i-1] * i % P
                self.__inv[i] = - self.__inv[P%i] * (P//i) % P
                self.__inv_fact[i] = self.__inv_fact[i-1] * self.__inv[i] % P
             i range(2,N+1) range 2 N+1 N 1 self.__fact[i] = self.__fact[i-1] * i % P self.__fact[i] self.__fact self __fact i self.__fact[i-1] * i % P self.__fact[i-1] * i self.__fact[i-1] self.__fact self __fact i-1 i 1 i P self.__inv[i] = - self.__inv[P%i] * (P//i) % P self.__inv[i] self.__inv self __inv i - self.__inv[P%i] * (P//i) % P - self.__inv[P%i] * (P//i) - self.__inv[P%i] self.__inv[P%i] self.__inv self __inv P%i P i P//i P i P self.__inv_fact[i] = self.__inv_fact[i-1] * self.__inv[i] % P self.__inv_fact[i] self.__inv_fact self __inv_fact i self.__inv_fact[i-1] * self.__inv[i] % P self.__inv_fact[i-1] * self.__inv[i] self.__inv_fact[i-1] self.__inv_fact self __inv_fact i-1 i 1 self.__inv[i] self.__inv self __inv i P self.fact = lambda n: self.__fact[n] self.fact self fact lambda n: self.__fact[n] self.__fact[n] self.__fact self __fact n n self.perm = lambda n,r: self.__fact[n] * self.__inv_fact[n-r] % P self.perm self perm lambda n,r: self.__fact[n] * self.__inv_fact[n-r] % P self.__fact[n] * self.__inv_fact[n-r] % P self.__fact[n] * self.__inv_fact[n-r] self.__fact[n] self.__fact self __fact n self.__inv_fact[n-r] self.__inv_fact self __inv_fact n-r n r P n r self.cmb = lambda n,r: (self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P) if r > 0 else 1 self.cmb self cmb lambda n,r: (self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P) if r > 0 else 1 (self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P) if r > 0 else 1 r > 0 r 0 self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] self.__fact[n] * self.__inv_fact[n-r] self.__fact[n] self.__fact self __fact n self.__inv_fact[n-r] self.__inv_fact self __inv_fact n-r n r self.__inv_fact[r] self.__inv_fact self __inv_fact r P 1 n r self self N N P=10**9+7 P 10**9+7 10**9 10 9 7 import sys,os sys os sys.setrecursionlimit(10**6) sys.setrecursionlimit sys setrecursionlimit 10**6 10 6 write = sys.stdout.write write sys.stdout.write sys.stdout sys stdout write dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0 dbg (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0 'TERM_PROGRAM' in os.environ 'TERM_PROGRAM' os.environ os environ lambda *something: print(*something) print(*something) print *something something *something lambda *x: 0 0 *x def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7
    from collections import deque
    
    n,k = LMIIS()
    cmb = Combination(2*n)
    ans = 1
    for i in range(1,min(n,k+1)):
        ans = (ans + cmb.cmb(n,i) * cmb.cmb(n-1,i)) % MOD
    print(ans)

     main input = lambda: given().rstrip() input lambda: given().rstrip() given().rstrip() ().rstrip () given rstrip LMIIS = lambda: list(map(int,input().split())) LMIIS lambda: list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split II = lambda: int(input()) II lambda: int(input()) int(input()) int input() input LMIIS() for _ in range(x) for _ in range(x) _ range(x) range x for _ in range(x) LMIIS() LMIIS XLMIIS = lambda x: [LMIIS() for _ in range(x)] XLMIIS lambda x: [LMIIS() for _ in range(x)] [LMIIS() for _ in range(x)] x YN = lambda c : print('Yes') if c else print('No') YN lambda c : print('Yes') if c else print('No') print('Yes') if c else print('No') c print('Yes') print 'Yes' print('No') print 'No' c MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 from collections import deque n,k = LMIIS() n LMIIS() LMIIS k cmb = Combination(2*n) cmb Combination(2*n) Combination 2*n 2 n ans = 1 ans 1 for i in range(1,min(n,k+1)):
        ans = (ans + cmb.cmb(n,i) * cmb.cmb(n-1,i)) % MOD
     i range(1,min(n,k+1)) range 1 min(n,k+1) min n k+1 k 1 ans = (ans + cmb.cmb(n,i) * cmb.cmb(n-1,i)) % MOD ans (ans + cmb.cmb(n,i) * cmb.cmb(n-1,i)) % MOD ans + cmb.cmb(n,i) * cmb.cmb(n-1,i) ans cmb.cmb(n,i) * cmb.cmb(n-1,i) cmb.cmb(n,i) cmb.cmb cmb cmb n i cmb.cmb(n-1,i) cmb.cmb cmb cmb n-1 n 1 i MOD print(ans) print ans given=sys.stdin.readline given sys.stdin.readline sys.stdin sys stdin readline if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7
    from collections import deque
    
    n,k = LMIIS()
    cmb = Combination(2*n)
    ans = 1
    for i in range(1,min(n,k+1)):
        ans = (ans + cmb.cmb(n,i) * cmb.cmb(n-1,i)) % MOD
    print(ans)

     def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7
    from collections import deque
    
    n,k = LMIIS()
    cmb = Combination(2*n)
    ans = 1
    for i in range(1,min(n,k+1)):
        ans = (ans + cmb.cmb(n,i) * cmb.cmb(n-1,i)) % MOD
    print(ans)

     main class Combination:
    def __init__(self,N,P=10**9+7):
        if N > 10**7:
            self.fact = lambda x: x * self.fact(x-1) % P if x > 2 else 2
            self.perm = lambda x, r: x * self.perm(x-1,r-1) % P if r > 0 else 1
            self.cmb = lambda n,r: (self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P) if r > 0 else 1
        else:
            self.__fact = [1] * (N+1)
            self.__inv = [1] * (N+1)
            self.__inv_fact = [1] * (N+1)
            for i in range(2,N+1):
                self.__fact[i] = self.__fact[i-1] * i % P
                self.__inv[i] = - self.__inv[P%i] * (P//i) % P
                self.__inv_fact[i] = self.__inv_fact[i-1] * self.__inv[i] % P
            self.fact = lambda n: self.__fact[n]
            self.perm = lambda n,r: self.__fact[n] * self.__inv_fact[n-r] % P
            self.cmb = lambda n,r: (self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P) if r > 0 else 1 class Combination:
    def __init__(self,N,P=10**9+7):
        if N > 10**7:
            self.fact = lambda x: x * self.fact(x-1) % P if x > 2 else 2
            self.perm = lambda x, r: x * self.perm(x-1,r-1) % P if r > 0 else 1
            self.cmb = lambda n,r: (self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P) if r > 0 else 1
        else:
            self.__fact = [1] * (N+1)
            self.__inv = [1] * (N+1)
            self.__inv_fact = [1] * (N+1)
            for i in range(2,N+1):
                self.__fact[i] = self.__fact[i-1] * i % P
                self.__inv[i] = - self.__inv[P%i] * (P//i) % P
                self.__inv_fact[i] = self.__inv_fact[i-1] * self.__inv[i] % P
            self.fact = lambda n: self.__fact[n]
            self.perm = lambda n,r: self.__fact[n] * self.__inv_fact[n-r] % P
            self.cmb = lambda n,r: (self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P) if r > 0 else 1 Combination write = sys.stdout.write sys.stdout.write write dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0 (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0 dbg
#coding:utf-8
class Combination:
    def __init__(self,N,P=10**9+7):
        if N > 10**7:
            self.fact = lambda x: x * self.fact(x-1) % P if x > 2 else 2
            self.perm = lambda x, r: x * self.perm(x-1,r-1) % P if r > 0 else 1
            self.cmb = lambda n,r: (self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P) if r > 0 else 1
        else:
            self.__fact = [1] * (N+1)
            self.__inv = [1] * (N+1)
            self.__inv_fact = [1] * (N+1)
            for i in range(2,N+1):
                self.__fact[i] = self.__fact[i-1] * i % P
                self.__inv[i] = - self.__inv[P%i] * (P//i) % P
                self.__inv_fact[i] = self.__inv_fact[i-1] * self.__inv[i] % P
            self.fact = lambda n: self.__fact[n]
            self.perm = lambda n,r: self.__fact[n] * self.__inv_fact[n-r] % P
            self.cmb = lambda n,r: (self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P) if r > 0 else 1






import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7
    from collections import deque
    
    n,k = LMIIS()
    cmb = Combination(2*n)
    ans = 1
    for i in range(1,min(n,k+1)):
        ans = (ans + cmb.cmb(n,i) * cmb.cmb(n-1,i)) % MOD
    print(ans)

    
if __name__ == '__main__':
    main()