from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

class Combination:
    """
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

co = Combination(200006)
n,m = inpl()
if m >= n:
    m = n-1
res = 1
if m == 1:
    print(co(n-1,n-2) * n)
    quit()
else:
    for i in range(m):
        tmp = i+1
        res += co(n-1,n-tmp-1) * co(n,tmp)
        res %= mod
        # print(res)
print(res) from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions sys bisect math itertools fractions sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 INF = float('inf') INF float('inf') float 'inf' def inp(): return int(sys.stdin.readline()) inp def inpl(): return list(map(int, sys.stdin.readline().split())) inpl class Combination:
    """
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv Combination """
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """ def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

     __init__ self.mod = mod self.mod self mod mod self.modinv = self.make_modinv_list(n_max) self.modinv self modinv self.make_modinv_list(n_max) self.make_modinv_list self make_modinv_list n_max self.fac, self.facinv = self.make_factorial_list(n_max) self.fac self fac self.make_factorial_list(n_max) self.make_factorial_list self make_factorial_list n_max self.facinv self facinv self self n_max n_max mod=10**9+7 mod 10**9+7 10**9 10 9 7 def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

     __call__ return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] self.fac[n] * self.facinv[r] % self.mod self.fac[n] * self.facinv[r] self.fac[n] self.fac self fac n self.facinv[r] self.facinv self facinv r self.mod self mod self.facinv[n-r] self.facinv self facinv n-r n r self.mod self mod self self n n r r def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

     make_factorial_list fac = [1] fac [1] 1 facinv = [1] facinv [1] 1 for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
         i range(1, n+1) range 1 n+1 n 1 fac.append(fac[i-1] * i % self.mod) fac.append fac append fac[i-1] * i % self.mod fac[i-1] * i fac[i-1] fac i-1 i 1 i self.mod self mod facinv.append(facinv[i-1] * self.modinv[i] % self.mod) facinv.append facinv append facinv[i-1] * self.modinv[i] % self.mod facinv[i-1] * self.modinv[i] facinv[i-1] facinv i-1 i 1 self.modinv[i] self.modinv self modinv i self.mod self mod return fac, facinv return fac, facinv fac facinv self self n n def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv make_modinv_list modinv = [0] * (n+1) modinv [0] * (n+1) [0] 0 n+1 n 1 modinv[1] = 1 modinv[1] modinv 1 1 for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
         i range(2, n+1) range 2 n+1 n 1 modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod modinv[i] modinv i self.mod - self.mod//i * modinv[self.mod%i] % self.mod self.mod self mod self.mod//i * modinv[self.mod%i] % self.mod self.mod//i * modinv[self.mod%i] self.mod//i self.mod self mod i modinv[self.mod%i] modinv self.mod%i self.mod self mod i self.mod self mod return modinv modinv self self n n co = Combination(200006) co Combination(200006) Combination 200006 n,m = inpl() n inpl() inpl m if m >= n:
    m = n-1 m >= n m n m = n-1 m n-1 n 1 res = 1 res 1 if m == 1:
    print(co(n-1,n-2) * n)
    quit()
else:
    for i in range(m):
        tmp = i+1
        res += co(n-1,n-tmp-1) * co(n,tmp)
        res %= mod
        # print(res) m == 1 m 1 print(co(n-1,n-2) * n) print co(n-1,n-2) * n co(n-1,n-2) co n-1 n 1 n-2 n 2 n quit() quit for i in range(m):
        tmp = i+1
        res += co(n-1,n-tmp-1) * co(n,tmp)
        res %= mod
        # print(res) i range(m) range m tmp = i+1 tmp i+1 i 1 res += co(n-1,n-tmp-1) * co(n,tmp) res co(n-1,n-tmp-1) * co(n,tmp) co(n-1,n-tmp-1) co n-1 n 1 n-tmp-1 n-tmp n tmp 1 co(n,tmp) co n tmp res %= mod res mod print(res) print res def inp(): return int(sys.stdin.readline()) def inp(): return int(sys.stdin.readline()) inp class Combination:
    """
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv class Combination:
    """
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv Combination INF = float('inf') float('inf') INF co = Combination(200006) Combination(200006) co m = inpl() inpl() m def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl(): return list(map(int, sys.stdin.readline().split())) inpl n,m = inpl() inpl() n mod = 10**9+7 10**9+7 mod m = n-1 n-1 m res += co(n-1,n-tmp-1) * co(n,tmp) co(n-1,n-tmp-1) * co(n,tmp) res res %= mod mod res tmp = i+1 i+1 tmp res = 1 1 res
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

class Combination:
    """
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

co = Combination(200006)
n,m = inpl()
if m >= n:
    m = n-1
res = 1
if m == 1:
    print(co(n-1,n-2) * n)
    quit()
else:
    for i in range(m):
        tmp = i+1
        res += co(n-1,n-tmp-1) * co(n,tmp)
        res %= mod
        # print(res)
print(res)