import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N, K = map(int, input().split())
MAX = 10 ** 6 + 5
MOD = 10 ** 9 + 7

fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]

def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod


def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod

def p(n, r, mod):
    return fac[n] * finv[n - r] % mod
    
comInit(MOD)

ans = 0
if K + 1 >= N:
    ans = com(N + N - 1, N - 1, MOD)
else:
    for i in range(K + 1):
        ans += com(N, i, MOD) * com(i + N - i - 1, i, MOD) % MOD
        ans %= MOD
print(ans % MOD) import sys sys import itertools itertools import time time import math math from heapq import heappop, heappush from collections import defaultdict from collections import Counter from collections import deque from itertools import permutations sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 INF = 10 ** 18 INF 10 ** 18 10 18 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines N, K = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split K MAX = 10 ** 6 + 5 MAX 10 ** 6 + 5 10 ** 6 10 6 5 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 0 for i in range(MAX) for i in range(MAX) i range(MAX) range MAX for i in range(MAX) 0 fac = [0 for i in range(MAX)] fac [0 for i in range(MAX)] 0 for i in range(MAX) for i in range(MAX) i range(MAX) range MAX for i in range(MAX) 0 finv = [0 for i in range(MAX)] finv [0 for i in range(MAX)] 0 for i in range(MAX) for i in range(MAX) i range(MAX) range MAX for i in range(MAX) 0 inv = [0 for i in range(MAX)] inv [0 for i in range(MAX)] def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod comInit fac[0], fac[1] = 1, 1 fac[0] fac 0 1 fac[1] fac 1 1 finv[0], finv[1] = 1, 1 finv[0] finv 0 1 finv[1] finv 1 1 inv[1] = 1 inv[1] inv 1 1 for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod i range(2, MAX) range 2 MAX fac[i] = fac[i - 1] * i % mod fac[i] fac i fac[i - 1] * i % mod fac[i - 1] * i fac[i - 1] fac i - 1 i 1 i mod inv[i] = mod - inv[mod % i] * (mod // i) % mod inv[i] inv i mod - inv[mod % i] * (mod // i) % mod mod inv[mod % i] * (mod // i) % mod inv[mod % i] * (mod // i) inv[mod % i] inv mod % i mod i mod // i mod i mod finv[i] = finv[i - 1] * inv[i] % mod finv[i] finv i finv[i - 1] * inv[i] % mod finv[i - 1] * inv[i] finv[i - 1] finv i - 1 i 1 inv[i] inv i mod mod mod def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod com if n < r:
        return 0
     n < r n r return 0 0 if n < 0 or r < 0:
        return 0
     n < 0 or r < 0 n < 0 n 0 r < 0 r 0 return 0 0 return fac[n] * (finv[r] * finv[n - r] % mod) % mod fac[n] * (finv[r] * finv[n - r] % mod) % mod fac[n] * (finv[r] * finv[n - r] % mod) fac[n] fac n finv[r] * finv[n - r] % mod finv[r] * finv[n - r] finv[r] finv r finv[n - r] finv n - r n r mod mod n n r r mod mod def p(n, r, mod):
    return fac[n] * finv[n - r] % mod
     p return fac[n] * finv[n - r] % mod fac[n] * finv[n - r] % mod fac[n] * finv[n - r] fac[n] fac n finv[n - r] finv n - r n r mod n n r r mod mod comInit(MOD) comInit MOD ans = 0 ans 0 if K + 1 >= N:
    ans = com(N + N - 1, N - 1, MOD)
else:
    for i in range(K + 1):
        ans += com(N, i, MOD) * com(i + N - i - 1, i, MOD) % MOD
        ans %= MOD K + 1 >= N K + 1 K 1 N ans = com(N + N - 1, N - 1, MOD) ans com(N + N - 1, N - 1, MOD) com N + N - 1 N + N N N 1 N - 1 N 1 MOD for i in range(K + 1):
        ans += com(N, i, MOD) * com(i + N - i - 1, i, MOD) % MOD
        ans %= MOD i range(K + 1) range K + 1 K 1 ans += com(N, i, MOD) * com(i + N - i - 1, i, MOD) % MOD ans com(N, i, MOD) * com(i + N - i - 1, i, MOD) % MOD com(N, i, MOD) * com(i + N - i - 1, i, MOD) com(N, i, MOD) com N i MOD com(i + N - i - 1, i, MOD) com i + N - i - 1 i + N - i i + N i N i 1 i MOD MOD ans %= MOD ans MOD print(ans % MOD) print ans % MOD ans MOD INF = 10 ** 18 10 ** 18 INF readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline MAX = 10 ** 6 + 5 10 ** 6 + 5 MAX MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod com def p(n, r, mod):
    return fac[n] * finv[n - r] % mod
     def p(n, r, mod):
    return fac[n] * finv[n - r] % mod
     p ans += com(N, i, MOD) * com(i + N - i - 1, i, MOD) % MOD com(N, i, MOD) * com(i + N - i - 1, i, MOD) % MOD ans readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD ans = com(N + N - 1, N - 1, MOD) com(N + N - 1, N - 1, MOD) ans finv = [0 for i in range(MAX)] [0 for i in range(MAX)] finv def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod comInit K = map(int, input().split()) map(int, input().split()) K ans = 0 0 ans ans %= MOD MOD ans fac = [0 for i in range(MAX)] [0 for i in range(MAX)] fac inv = [0 for i in range(MAX)] [0 for i in range(MAX)] inv N, K = map(int, input().split()) map(int, input().split()) N read = sys.stdin.buffer.read sys.stdin.buffer.read read
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N, K = map(int, input().split())
MAX = 10 ** 6 + 5
MOD = 10 ** 9 + 7

fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]

def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod


def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod

def p(n, r, mod):
    return fac[n] * finv[n - r] % mod
    
comInit(MOD)

ans = 0
if K + 1 >= N:
    ans = com(N + N - 1, N - 1, MOD)
else:
    for i in range(K + 1):
        ans += com(N, i, MOD) * com(i + N - i - 1, i, MOD) % MOD
        ans %= MOD
print(ans % MOD)