class Cmb:
    def __init__(self, N, mod=10**9+7):
        self.fact = [1,1]
        self.fact_inv = [1,1]
        self.inv = [0,1]
        
        """ 階乗を保存する配列を作成 """
        for i in range(2, N+1):
            self.fact.append((self.fact[-1]*i) % mod)
            self.inv.append((-self.inv[mod%i] * (mod//i))%mod)
            self.fact_inv.append((self.fact_inv[-1]*self.inv[i])%mod)
    
    """ 関数として使えるように、callで定義 """
    def __call__(self, n, r, mod=10**9+7):
        if (r<0) or (n<r):
            return 0
        r = min(r, n-r)
        return self.fact[n] * self.fact_inv[r] * self.fact_inv[n-r] % mod

n,k = map(int,input().split())
mod = 10**9+7
c = Cmb(N=n)
ans = 0
for l in range(min(k+1, n)):
    tmp = c(n,l)*c(n-1, n-l-1)
    ans += tmp%mod
print(ans%mod) class Cmb:
    def __init__(self, N, mod=10**9+7):
        self.fact = [1,1]
        self.fact_inv = [1,1]
        self.inv = [0,1]
        
        """ 階乗を保存する配列を作成 """
        for i in range(2, N+1):
            self.fact.append((self.fact[-1]*i) % mod)
            self.inv.append((-self.inv[mod%i] * (mod//i))%mod)
            self.fact_inv.append((self.fact_inv[-1]*self.inv[i])%mod)
    
    """ 関数として使えるように、callで定義 """
    def __call__(self, n, r, mod=10**9+7):
        if (r<0) or (n<r):
            return 0
        r = min(r, n-r)
        return self.fact[n] * self.fact_inv[r] * self.fact_inv[n-r] % mod Cmb def __init__(self, N, mod=10**9+7):
        self.fact = [1,1]
        self.fact_inv = [1,1]
        self.inv = [0,1]
        
        """ 階乗を保存する配列を作成 """
        for i in range(2, N+1):
            self.fact.append((self.fact[-1]*i) % mod)
            self.inv.append((-self.inv[mod%i] * (mod//i))%mod)
            self.fact_inv.append((self.fact_inv[-1]*self.inv[i])%mod)
    
     __init__ self.fact = [1,1] self.fact self fact [1,1] 1 1 self.fact_inv = [1,1] self.fact_inv self fact_inv [1,1] 1 1 self.inv = [0,1] self.inv self inv [0,1] 0 1 """ 階乗を保存する配列を作成 """ for i in range(2, N+1):
            self.fact.append((self.fact[-1]*i) % mod)
            self.inv.append((-self.inv[mod%i] * (mod//i))%mod)
            self.fact_inv.append((self.fact_inv[-1]*self.inv[i])%mod)
    
     i range(2, N+1) range 2 N+1 N 1 self.fact.append((self.fact[-1]*i) % mod) self.fact.append self.fact self fact append (self.fact[-1]*i) % mod self.fact[-1]*i self.fact[-1] self.fact self fact -1 i mod self.inv.append((-self.inv[mod%i] * (mod//i))%mod) self.inv.append self.inv self inv append (-self.inv[mod%i] * (mod//i))%mod -self.inv[mod%i] * (mod//i) -self.inv[mod%i] self.inv[mod%i] self.inv self inv mod%i mod i mod//i mod i mod self.fact_inv.append((self.fact_inv[-1]*self.inv[i])%mod) self.fact_inv.append self.fact_inv self fact_inv append (self.fact_inv[-1]*self.inv[i])%mod self.fact_inv[-1]*self.inv[i] self.fact_inv[-1] self.fact_inv self fact_inv -1 self.inv[i] self.inv self inv i mod self self N N mod=10**9+7 mod 10**9+7 10**9 10 9 7 """ 関数として使えるように、callで定義 """ def __call__(self, n, r, mod=10**9+7):
        if (r<0) or (n<r):
            return 0
        r = min(r, n-r)
        return self.fact[n] * self.fact_inv[r] * self.fact_inv[n-r] % mod __call__ if (r<0) or (n<r):
            return 0
         (r<0) or (n<r) r<0 r 0 n<r n r return 0 0 r = min(r, n-r) r min(r, n-r) min r n-r n r return self.fact[n] * self.fact_inv[r] * self.fact_inv[n-r] % mod self.fact[n] * self.fact_inv[r] * self.fact_inv[n-r] % mod self.fact[n] * self.fact_inv[r] * self.fact_inv[n-r] self.fact[n] * self.fact_inv[r] self.fact[n] self.fact self fact n self.fact_inv[r] self.fact_inv self fact_inv r self.fact_inv[n-r] self.fact_inv self fact_inv n-r n r mod self self n n r r mod=10**9+7 mod 10**9+7 10**9 10 9 7 n,k = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split k mod = 10**9+7 mod 10**9+7 10**9 10 9 7 c = Cmb(N=n) c Cmb(N=n) Cmb N=n N n ans = 0 ans 0 for l in range(min(k+1, n)):
    tmp = c(n,l)*c(n-1, n-l-1)
    ans += tmp%mod l range(min(k+1, n)) range min(k+1, n) min k+1 k 1 n tmp = c(n,l)*c(n-1, n-l-1) tmp c(n,l)*c(n-1, n-l-1) c(n,l) c n l c(n-1, n-l-1) c n-1 n 1 n-l-1 n-l n l 1 ans += tmp%mod ans tmp%mod tmp mod print(ans%mod) print ans%mod ans mod class Cmb:
    def __init__(self, N, mod=10**9+7):
        self.fact = [1,1]
        self.fact_inv = [1,1]
        self.inv = [0,1]
        
        """ 階乗を保存する配列を作成 """
        for i in range(2, N+1):
            self.fact.append((self.fact[-1]*i) % mod)
            self.inv.append((-self.inv[mod%i] * (mod//i))%mod)
            self.fact_inv.append((self.fact_inv[-1]*self.inv[i])%mod)
    
    """ 関数として使えるように、callで定義 """
    def __call__(self, n, r, mod=10**9+7):
        if (r<0) or (n<r):
            return 0
        r = min(r, n-r)
        return self.fact[n] * self.fact_inv[r] * self.fact_inv[n-r] % mod class Cmb:
    def __init__(self, N, mod=10**9+7):
        self.fact = [1,1]
        self.fact_inv = [1,1]
        self.inv = [0,1]
        
        """ 階乗を保存する配列を作成 """
        for i in range(2, N+1):
            self.fact.append((self.fact[-1]*i) % mod)
            self.inv.append((-self.inv[mod%i] * (mod//i))%mod)
            self.fact_inv.append((self.fact_inv[-1]*self.inv[i])%mod)
    
    """ 関数として使えるように、callで定義 """
    def __call__(self, n, r, mod=10**9+7):
        if (r<0) or (n<r):
            return 0
        r = min(r, n-r)
        return self.fact[n] * self.fact_inv[r] * self.fact_inv[n-r] % mod Cmb ans += tmp%mod tmp%mod ans n,k = map(int,input().split()) map(int,input().split()) n mod = 10**9+7 10**9+7 mod ans = 0 0 ans tmp = c(n,l)*c(n-1, n-l-1) c(n,l)*c(n-1, n-l-1) tmp k = map(int,input().split()) map(int,input().split()) k c = Cmb(N=n) Cmb(N=n) c
class Cmb:
    def __init__(self, N, mod=10**9+7):
        self.fact = [1,1]
        self.fact_inv = [1,1]
        self.inv = [0,1]
        
        """ 階乗を保存する配列を作成 """
        for i in range(2, N+1):
            self.fact.append((self.fact[-1]*i) % mod)
            self.inv.append((-self.inv[mod%i] * (mod//i))%mod)
            self.fact_inv.append((self.fact_inv[-1]*self.inv[i])%mod)
    
    """ 関数として使えるように、callで定義 """
    def __call__(self, n, r, mod=10**9+7):
        if (r<0) or (n<r):
            return 0
        r = min(r, n-r)
        return self.fact[n] * self.fact_inv[r] * self.fact_inv[n-r] % mod

n,k = map(int,input().split())
mod = 10**9+7
c = Cmb(N=n)
ans = 0
for l in range(min(k+1, n)):
    tmp = c(n,l)*c(n-1, n-l-1)
    ans += tmp%mod
print(ans%mod)