import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)


class Combination:
    def __init__(self, mod=10**9+7, n=202020):
        self.f = [0] * n
        self.rf = [0] * n
        self.inv = [0] * n
        self.f[0], self.f[1] = 1, 1
        self.rf[0], self.rf[1] = 1, 1
        self.inv[1] = 1
        self.MOD = mod
        for i in range(2, n):
            self.f[i] = (self.f[i - 1] * i) % self.MOD
            self.inv[i] = (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD
            self.rf[i] = (self.rf[i - 1] * self.inv[i]) % self.MOD

    def __call__(self, n, r):
        return (self.f[n] * self.rf[r] * self.rf[n - r]) % self.MOD


C = Combination()
n, k = map(int, input().split())
ans = 1
for i in range(1, min(k, n-1)+1):
    tmp = (C(n, i) * C(n-1, i)) % MOD
    ans = (ans + tmp) % MOD

print(ans) import sys sys from collections import defaultdict, Counter, namedtuple, deque import itertools itertools import functools functools import bisect bisect import heapq heapq import math math MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 class Combination:
    def __init__(self, mod=10**9+7, n=202020):
        self.f = [0] * n
        self.rf = [0] * n
        self.inv = [0] * n
        self.f[0], self.f[1] = 1, 1
        self.rf[0], self.rf[1] = 1, 1
        self.inv[1] = 1
        self.MOD = mod
        for i in range(2, n):
            self.f[i] = (self.f[i - 1] * i) % self.MOD
            self.inv[i] = (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD
            self.rf[i] = (self.rf[i - 1] * self.inv[i]) % self.MOD

    def __call__(self, n, r):
        return (self.f[n] * self.rf[r] * self.rf[n - r]) % self.MOD Combination def __init__(self, mod=10**9+7, n=202020):
        self.f = [0] * n
        self.rf = [0] * n
        self.inv = [0] * n
        self.f[0], self.f[1] = 1, 1
        self.rf[0], self.rf[1] = 1, 1
        self.inv[1] = 1
        self.MOD = mod
        for i in range(2, n):
            self.f[i] = (self.f[i - 1] * i) % self.MOD
            self.inv[i] = (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD
            self.rf[i] = (self.rf[i - 1] * self.inv[i]) % self.MOD

     __init__ self.f = [0] * n self.f self f [0] * n [0] 0 n self.rf = [0] * n self.rf self rf [0] * n [0] 0 n self.inv = [0] * n self.inv self inv [0] * n [0] 0 n self.f[0], self.f[1] = 1, 1 self.f[0] self.f self f 0 1 self.f[1] self.f self f 1 1 self.rf[0], self.rf[1] = 1, 1 self.rf[0] self.rf self rf 0 1 self.rf[1] self.rf self rf 1 1 self.inv[1] = 1 self.inv[1] self.inv self inv 1 1 self.MOD = mod self.MOD self MOD mod for i in range(2, n):
            self.f[i] = (self.f[i - 1] * i) % self.MOD
            self.inv[i] = (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD
            self.rf[i] = (self.rf[i - 1] * self.inv[i]) % self.MOD

     i range(2, n) range 2 n self.f[i] = (self.f[i - 1] * i) % self.MOD self.f[i] self.f self f i (self.f[i - 1] * i) % self.MOD self.f[i - 1] * i self.f[i - 1] self.f self f i - 1 i 1 i self.MOD self MOD self.inv[i] = (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD self.inv[i] self.inv self inv i (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD -self.inv[self.MOD % i] * (self.MOD // i) -self.inv[self.MOD % i] self.inv[self.MOD % i] self.inv self inv self.MOD % i self.MOD self MOD i self.MOD // i self.MOD self MOD i self.MOD self MOD self.rf[i] = (self.rf[i - 1] * self.inv[i]) % self.MOD self.rf[i] self.rf self rf i (self.rf[i - 1] * self.inv[i]) % self.MOD self.rf[i - 1] * self.inv[i] self.rf[i - 1] self.rf self rf i - 1 i 1 self.inv[i] self.inv self inv i self.MOD self MOD self self mod=10**9+7 mod 10**9+7 10**9 10 9 7 n=202020 n 202020 def __call__(self, n, r):
        return (self.f[n] * self.rf[r] * self.rf[n - r]) % self.MOD __call__ return (self.f[n] * self.rf[r] * self.rf[n - r]) % self.MOD (self.f[n] * self.rf[r] * self.rf[n - r]) % self.MOD self.f[n] * self.rf[r] * self.rf[n - r] self.f[n] * self.rf[r] self.f[n] self.f self f n self.rf[r] self.rf self rf r self.rf[n - r] self.rf self rf n - r n r self.MOD self MOD self self n n r r C = Combination() C Combination() Combination n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k ans = 1 ans 1 for i in range(1, min(k, n-1)+1):
    tmp = (C(n, i) * C(n-1, i)) % MOD
    ans = (ans + tmp) % MOD i range(1, min(k, n-1)+1) range 1 min(k, n-1)+1 min(k, n-1) min k n-1 n 1 1 tmp = (C(n, i) * C(n-1, i)) % MOD tmp (C(n, i) * C(n-1, i)) % MOD C(n, i) * C(n-1, i) C(n, i) C n i C(n-1, i) C n-1 n 1 i MOD ans = (ans + tmp) % MOD ans (ans + tmp) % MOD ans + tmp ans tmp MOD print(ans) print ans ans = (ans + tmp) % MOD (ans + tmp) % MOD ans MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD n, k = map(int, input().split()) map(int, input().split()) n C = Combination() Combination() C k = map(int, input().split()) map(int, input().split()) k tmp = (C(n, i) * C(n-1, i)) % MOD (C(n, i) * C(n-1, i)) % MOD tmp class Combination:
    def __init__(self, mod=10**9+7, n=202020):
        self.f = [0] * n
        self.rf = [0] * n
        self.inv = [0] * n
        self.f[0], self.f[1] = 1, 1
        self.rf[0], self.rf[1] = 1, 1
        self.inv[1] = 1
        self.MOD = mod
        for i in range(2, n):
            self.f[i] = (self.f[i - 1] * i) % self.MOD
            self.inv[i] = (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD
            self.rf[i] = (self.rf[i - 1] * self.inv[i]) % self.MOD

    def __call__(self, n, r):
        return (self.f[n] * self.rf[r] * self.rf[n - r]) % self.MOD class Combination:
    def __init__(self, mod=10**9+7, n=202020):
        self.f = [0] * n
        self.rf = [0] * n
        self.inv = [0] * n
        self.f[0], self.f[1] = 1, 1
        self.rf[0], self.rf[1] = 1, 1
        self.inv[1] = 1
        self.MOD = mod
        for i in range(2, n):
            self.f[i] = (self.f[i - 1] * i) % self.MOD
            self.inv[i] = (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD
            self.rf[i] = (self.rf[i - 1] * self.inv[i]) % self.MOD

    def __call__(self, n, r):
        return (self.f[n] * self.rf[r] * self.rf[n - r]) % self.MOD Combination ans = 1 1 ans
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)


class Combination:
    def __init__(self, mod=10**9+7, n=202020):
        self.f = [0] * n
        self.rf = [0] * n
        self.inv = [0] * n
        self.f[0], self.f[1] = 1, 1
        self.rf[0], self.rf[1] = 1, 1
        self.inv[1] = 1
        self.MOD = mod
        for i in range(2, n):
            self.f[i] = (self.f[i - 1] * i) % self.MOD
            self.inv[i] = (-self.inv[self.MOD % i] * (self.MOD // i)) % self.MOD
            self.rf[i] = (self.rf[i - 1] * self.inv[i]) % self.MOD

    def __call__(self, n, r):
        return (self.f[n] * self.rf[r] * self.rf[n - r]) % self.MOD


C = Combination()
n, k = map(int, input().split())
ans = 1
for i in range(1, min(k, n-1)+1):
    tmp = (C(n, i) * C(n-1, i)) % MOD
    ans = (ans + tmp) % MOD

print(ans)
