#!/usr/bin/env python3

class Combination():
    # コンストラクタ
    def __init__(self, N:int, P:int):
        self.N = N
        self.P = P

        # fact[i] = (i! mod P)
        self.fact = [1, 1]   
        # factinv[i] = ((i!)^(-1) mod P)
        self.factinv = [1, 1]
        # factinv 計算用
        self.inv = [0, 1] 

        for i in range(2, N+1):
            self.fact.append((self.fact[-1] * i) % P)
            self.inv.append((-self.inv[P % i] * (P // i)) % P)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % P)
    
    # nCk (mod P)   (ただし、n<=N)
    def getComb(self, n:int, k:int):
        if (k < 0) or (n < k):
            return 0
        k = min(k, n - k)
        return self.fact[n] * self.factinv[k] % self.P * self.factinv[n-k] % self.P

n,k = map(int,input().split())
MOD = 10**9 +7

COMB = Combination(n,MOD)

ans = 0
for i in range(min(n, k+1)):
    ans += COMB.getComb(n,i) * COMB.getComb(n-1,i)
    ans %= MOD

print(ans) class Combination():
    # コンストラクタ
    def __init__(self, N:int, P:int):
        self.N = N
        self.P = P

        # fact[i] = (i! mod P)
        self.fact = [1, 1]   
        # factinv[i] = ((i!)^(-1) mod P)
        self.factinv = [1, 1]
        # factinv 計算用
        self.inv = [0, 1] 

        for i in range(2, N+1):
            self.fact.append((self.fact[-1] * i) % P)
            self.inv.append((-self.inv[P % i] * (P // i)) % P)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % P)
    
    # nCk (mod P)   (ただし、n<=N)
    def getComb(self, n:int, k:int):
        if (k < 0) or (n < k):
            return 0
        k = min(k, n - k)
        return self.fact[n] * self.factinv[k] % self.P * self.factinv[n-k] % self.P Combination def __init__(self, N:int, P:int):
        self.N = N
        self.P = P

        # fact[i] = (i! mod P)
        self.fact = [1, 1]   
        # factinv[i] = ((i!)^(-1) mod P)
        self.factinv = [1, 1]
        # factinv 計算用
        self.inv = [0, 1] 

        for i in range(2, N+1):
            self.fact.append((self.fact[-1] * i) % P)
            self.inv.append((-self.inv[P % i] * (P // i)) % P)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % P)
    
    # nCk (mod P)   (ただし、n<=N)
     __init__ self.N = N self.N self N N self.P = P self.P self P P self.fact = [1, 1] self.fact self fact [1, 1] 1 1 self.factinv = [1, 1] self.factinv self factinv [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) % P)
            self.inv.append((-self.inv[P % i] * (P // i)) % P)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % P)
    
    # nCk (mod P)   (ただし、n<=N)
     i range(2, N+1) range 2 N+1 N 1 self.fact.append((self.fact[-1] * i) % P) self.fact.append self.fact self fact append (self.fact[-1] * i) % P self.fact[-1] * i self.fact[-1] self.fact self fact -1 i P self.inv.append((-self.inv[P % i] * (P // i)) % P) self.inv.append self.inv self inv append (-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.factinv.append((self.factinv[-1] * self.inv[-1]) % P) self.factinv.append self.factinv self factinv append (self.factinv[-1] * self.inv[-1]) % P self.factinv[-1] * self.inv[-1] self.factinv[-1] self.factinv self factinv -1 self.inv[-1] self.inv self inv -1 P self self N:int N P:int P def getComb(self, n:int, k:int):
        if (k < 0) or (n < k):
            return 0
        k = min(k, n - k)
        return self.fact[n] * self.factinv[k] % self.P * self.factinv[n-k] % self.P getComb if (k < 0) or (n < k):
            return 0
         (k < 0) or (n < k) k < 0 k 0 n < k n k return 0 0 k = min(k, n - k) k min(k, n - k) min k n - k n k return self.fact[n] * self.factinv[k] % self.P * self.factinv[n-k] % self.P self.fact[n] * self.factinv[k] % self.P * self.factinv[n-k] % self.P self.fact[n] * self.factinv[k] % self.P * self.factinv[n-k] self.fact[n] * self.factinv[k] % self.P self.fact[n] * self.factinv[k] self.fact[n] self.fact self fact n self.factinv[k] self.factinv self factinv k self.P self P self.factinv[n-k] self.factinv self factinv n-k n k self.P self P self self n:int n k:int k 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 COMB = Combination(n,MOD) COMB Combination(n,MOD) Combination n MOD ans = 0 ans 0 for i in range(min(n, k+1)):
    ans += COMB.getComb(n,i) * COMB.getComb(n-1,i)
    ans %= MOD i range(min(n, k+1)) range min(n, k+1) min n k+1 k 1 ans += COMB.getComb(n,i) * COMB.getComb(n-1,i) ans COMB.getComb(n,i) * COMB.getComb(n-1,i) COMB.getComb(n,i) COMB.getComb COMB getComb n i COMB.getComb(n-1,i) COMB.getComb COMB getComb n-1 n 1 i ans %= MOD ans MOD print(ans) print ans COMB = Combination(n,MOD) Combination(n,MOD) COMB ans %= MOD MOD ans ans = 0 0 ans ans += COMB.getComb(n,i) * COMB.getComb(n-1,i) COMB.getComb(n,i) * COMB.getComb(n-1,i) ans class Combination():
    # コンストラクタ
    def __init__(self, N:int, P:int):
        self.N = N
        self.P = P

        # fact[i] = (i! mod P)
        self.fact = [1, 1]   
        # factinv[i] = ((i!)^(-1) mod P)
        self.factinv = [1, 1]
        # factinv 計算用
        self.inv = [0, 1] 

        for i in range(2, N+1):
            self.fact.append((self.fact[-1] * i) % P)
            self.inv.append((-self.inv[P % i] * (P // i)) % P)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % P)
    
    # nCk (mod P)   (ただし、n<=N)
    def getComb(self, n:int, k:int):
        if (k < 0) or (n < k):
            return 0
        k = min(k, n - k)
        return self.fact[n] * self.factinv[k] % self.P * self.factinv[n-k] % self.P class Combination():
    # コンストラクタ
    def __init__(self, N:int, P:int):
        self.N = N
        self.P = P

        # fact[i] = (i! mod P)
        self.fact = [1, 1]   
        # factinv[i] = ((i!)^(-1) mod P)
        self.factinv = [1, 1]
        # factinv 計算用
        self.inv = [0, 1] 

        for i in range(2, N+1):
            self.fact.append((self.fact[-1] * i) % P)
            self.inv.append((-self.inv[P % i] * (P // i)) % P)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % P)
    
    # nCk (mod P)   (ただし、n<=N)
    def getComb(self, n:int, k:int):
        if (k < 0) or (n < k):
            return 0
        k = min(k, n - k)
        return self.fact[n] * self.factinv[k] % self.P * self.factinv[n-k] % self.P Combination MOD = 10**9 +7 10**9 +7 MOD k = map(int,input().split()) map(int,input().split()) k n,k = map(int,input().split()) map(int,input().split()) n
#!/usr/bin/env python3

class Combination():
    # コンストラクタ
    def __init__(self, N:int, P:int):
        self.N = N
        self.P = P

        # fact[i] = (i! mod P)
        self.fact = [1, 1]   
        # factinv[i] = ((i!)^(-1) mod P)
        self.factinv = [1, 1]
        # factinv 計算用
        self.inv = [0, 1] 

        for i in range(2, N+1):
            self.fact.append((self.fact[-1] * i) % P)
            self.inv.append((-self.inv[P % i] * (P // i)) % P)
            self.factinv.append((self.factinv[-1] * self.inv[-1]) % P)
    
    # nCk (mod P)   (ただし、n<=N)
    def getComb(self, n:int, k:int):
        if (k < 0) or (n < k):
            return 0
        k = min(k, n - k)
        return self.fact[n] * self.factinv[k] % self.P * self.factinv[n-k] % self.P

n,k = map(int,input().split())
MOD = 10**9 +7

COMB = Combination(n,MOD)

ans = 0
for i in range(min(n, k+1)):
    ans += COMB.getComb(n,i) * COMB.getComb(n-1,i)
    ans %= MOD

print(ans)