def build_combinations_counter(N=10**5, p=10**9+7):
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # mod p におけるnの逆元 n^(-1)
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    
    def cmb(n, r, p, fact, factinv):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n-r] % p
    
    import functools
    return functools.partial(cmb, p=p, fact=fact, factinv=factinv)

def resolve():
    n, k = list(map(int, input().split()))
    MOD = 10**9+7
    counter = build_combinations_counter(2*10**5, 10**9+7)
    ans = 0
    for i in range(min(n, k+1)):
        ans += counter(n, i) * counter(n-1, n-i-1)
        ans %= MOD
    print(ans)
    
    
if __name__ == "__main__":
    resolve() def build_combinations_counter(N=10**5, p=10**9+7):
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # mod p におけるnの逆元 n^(-1)
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    
    def cmb(n, r, p, fact, factinv):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n-r] % p
    
    import functools
    return functools.partial(cmb, p=p, fact=fact, factinv=factinv) build_combinations_counter fact = [1, 1] fact [1, 1] 1 1 factinv = [1, 1] factinv [1, 1] 1 1 inv = [0, 1] inv [0, 1] 0 1 for i in range(2, N + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    
     i range(2, N + 1) range 2 N + 1 N 1 fact.append((fact[-1] * i) % p) fact.append fact append (fact[-1] * i) % p fact[-1] * i fact[-1] fact -1 i p inv.append((-inv[p % i] * (p // i)) % p) inv.append inv append (-inv[p % i] * (p // i)) % p -inv[p % i] * (p // i) -inv[p % i] inv[p % i] inv p % i p i p // i p i p factinv.append((factinv[-1] * inv[-1]) % p) factinv.append factinv append (factinv[-1] * inv[-1]) % p factinv[-1] * inv[-1] factinv[-1] factinv -1 inv[-1] inv -1 p def cmb(n, r, p, fact, factinv):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n-r] % p
    
     cmb 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 fact[n] * factinv[r] * factinv[n-r] % p fact[n] * factinv[r] * factinv[n-r] % p fact[n] * factinv[r] * factinv[n-r] fact[n] * factinv[r] fact[n] fact n factinv[r] factinv r factinv[n-r] factinv n-r n r p n n r r p p fact fact factinv factinv import functools functools return functools.partial(cmb, p=p, fact=fact, factinv=factinv) functools.partial(cmb, p=p, fact=fact, factinv=factinv) functools.partial functools partial cmb p=p p p fact=fact fact fact factinv=factinv factinv factinv N=10**5 N 10**5 10 5 p=10**9+7 p 10**9+7 10**9 10 9 7 def resolve():
    n, k = list(map(int, input().split()))
    MOD = 10**9+7
    counter = build_combinations_counter(2*10**5, 10**9+7)
    ans = 0
    for i in range(min(n, k+1)):
        ans += counter(n, i) * counter(n-1, n-i-1)
        ans %= MOD
    print(ans)
    
     resolve n, k = list(map(int, input().split())) n list(map(int, input().split())) list 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 counter = build_combinations_counter(2*10**5, 10**9+7) counter build_combinations_counter(2*10**5, 10**9+7) build_combinations_counter 2*10**5 2 10**5 10 5 10**9+7 10**9 10 9 7 ans = 0 ans 0 for i in range(min(n, k+1)):
        ans += counter(n, i) * counter(n-1, n-i-1)
        ans %= MOD
     i range(min(n, k+1)) range min(n, k+1) min n k+1 k 1 ans += counter(n, i) * counter(n-1, n-i-1) ans counter(n, i) * counter(n-1, n-i-1) counter(n, i) counter n i counter(n-1, n-i-1) counter n-1 n 1 n-i-1 n-i n i 1 ans %= MOD ans MOD print(ans) print ans if __name__ == "__main__":
    resolve() __name__ == "__main__" __name__ "__main__" resolve() resolve def build_combinations_counter(N=10**5, p=10**9+7):
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # mod p におけるnの逆元 n^(-1)
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    
    def cmb(n, r, p, fact, factinv):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n-r] % p
    
    import functools
    return functools.partial(cmb, p=p, fact=fact, factinv=factinv) def build_combinations_counter(N=10**5, p=10**9+7):
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # mod p におけるnの逆元 n^(-1)
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    
    def cmb(n, r, p, fact, factinv):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n-r] % p
    
    import functools
    return functools.partial(cmb, p=p, fact=fact, factinv=factinv) build_combinations_counter def resolve():
    n, k = list(map(int, input().split()))
    MOD = 10**9+7
    counter = build_combinations_counter(2*10**5, 10**9+7)
    ans = 0
    for i in range(min(n, k+1)):
        ans += counter(n, i) * counter(n-1, n-i-1)
        ans %= MOD
    print(ans)
    
     def resolve():
    n, k = list(map(int, input().split()))
    MOD = 10**9+7
    counter = build_combinations_counter(2*10**5, 10**9+7)
    ans = 0
    for i in range(min(n, k+1)):
        ans += counter(n, i) * counter(n-1, n-i-1)
        ans %= MOD
    print(ans)
    
     resolve
def build_combinations_counter(N=10**5, p=10**9+7):
    fact = [1, 1]  # fact[n] = (n! mod p)
    factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
    inv = [0, 1]  # mod p におけるnの逆元 n^(-1)
    for i in range(2, N + 1):
        fact.append((fact[-1] * i) % p)
        inv.append((-inv[p % i] * (p // i)) % p)
        factinv.append((factinv[-1] * inv[-1]) % p)
    
    def cmb(n, r, p, fact, factinv):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return fact[n] * factinv[r] * factinv[n-r] % p
    
    import functools
    return functools.partial(cmb, p=p, fact=fact, factinv=factinv)

def resolve():
    n, k = list(map(int, input().split()))
    MOD = 10**9+7
    counter = build_combinations_counter(2*10**5, 10**9+7)
    ans = 0
    for i in range(min(n, k+1)):
        ans += counter(n, i) * counter(n-1, n-i-1)
        ans %= MOD
    print(ans)
    
    
if __name__ == "__main__":
    resolve()
