MOD = 10**9 + 7
MAX = int(2e5)


def div(a, b):
    return a * pow(b, MOD-2, MOD) % MOD


FACT = [1] * (MAX+1)
for i in range(1, MAX+1):
    FACT[i] = (i * FACT[i-1]) % MOD
INV = [1] * (MAX+1)
INV[MAX] = div(1, FACT[MAX])
for i in range(MAX, 0, -1):
    INV[i-1] = (INV[i] * i) % MOD


def main():
    n, k = map(int, input().split())
    ans = 0
    for i in range(min(n-1, k)+1):
        # iCn
        # (n-i-1)C(n-1)
        tmp = FACT[n] * INV[i] * INV[n-i] % MOD
        tmp = (tmp * FACT[n-1] * INV[n-i-1] * INV[i]) % MOD
        ans = (ans + tmp) % MOD
    print(ans)


if __name__ == "__main__":
    main() MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 MAX = int(2e5) MAX int(2e5) int 2e5 def div(a, b):
    return a * pow(b, MOD-2, MOD) % MOD div return a * pow(b, MOD-2, MOD) % MOD a * pow(b, MOD-2, MOD) % MOD a * pow(b, MOD-2, MOD) a pow(b, MOD-2, MOD) pow b MOD-2 MOD 2 MOD MOD a a b b FACT = [1] * (MAX+1) FACT [1] * (MAX+1) [1] 1 MAX+1 MAX 1 for i in range(1, MAX+1):
    FACT[i] = (i * FACT[i-1]) % MOD i range(1, MAX+1) range 1 MAX+1 MAX 1 FACT[i] = (i * FACT[i-1]) % MOD FACT[i] FACT i (i * FACT[i-1]) % MOD i * FACT[i-1] i FACT[i-1] FACT i-1 i 1 MOD INV = [1] * (MAX+1) INV [1] * (MAX+1) [1] 1 MAX+1 MAX 1 INV[MAX] = div(1, FACT[MAX]) INV[MAX] INV MAX div(1, FACT[MAX]) div 1 FACT[MAX] FACT MAX for i in range(MAX, 0, -1):
    INV[i-1] = (INV[i] * i) % MOD i range(MAX, 0, -1) range MAX 0 -1 INV[i-1] = (INV[i] * i) % MOD INV[i-1] INV i-1 i 1 (INV[i] * i) % MOD INV[i] * i INV[i] INV i i MOD def main():
    n, k = map(int, input().split())
    ans = 0
    for i in range(min(n-1, k)+1):
        # iCn
        # (n-i-1)C(n-1)
        tmp = FACT[n] * INV[i] * INV[n-i] % MOD
        tmp = (tmp * FACT[n-1] * INV[n-i-1] * INV[i]) % MOD
        ans = (ans + tmp) % MOD
    print(ans) main n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k ans = 0 ans 0 for i in range(min(n-1, k)+1):
        # iCn
        # (n-i-1)C(n-1)
        tmp = FACT[n] * INV[i] * INV[n-i] % MOD
        tmp = (tmp * FACT[n-1] * INV[n-i-1] * INV[i]) % MOD
        ans = (ans + tmp) % MOD
     i range(min(n-1, k)+1) range min(n-1, k)+1 min(n-1, k) min n-1 n 1 k 1 tmp = FACT[n] * INV[i] * INV[n-i] % MOD tmp FACT[n] * INV[i] * INV[n-i] % MOD FACT[n] * INV[i] * INV[n-i] FACT[n] * INV[i] FACT[n] FACT n INV[i] INV i INV[n-i] INV n-i n i MOD tmp = (tmp * FACT[n-1] * INV[n-i-1] * INV[i]) % MOD tmp (tmp * FACT[n-1] * INV[n-i-1] * INV[i]) % MOD tmp * FACT[n-1] * INV[n-i-1] * INV[i] tmp * FACT[n-1] * INV[n-i-1] tmp * FACT[n-1] tmp FACT[n-1] FACT n-1 n 1 INV[n-i-1] INV n-i-1 n-i n i 1 INV[i] INV i MOD ans = (ans + tmp) % MOD ans (ans + tmp) % MOD ans + tmp ans tmp MOD print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main INV = [1] * (MAX+1) [1] * (MAX+1) INV MAX = int(2e5) int(2e5) MAX MOD = 10**9 + 7 10**9 + 7 MOD def main():
    n, k = map(int, input().split())
    ans = 0
    for i in range(min(n-1, k)+1):
        # iCn
        # (n-i-1)C(n-1)
        tmp = FACT[n] * INV[i] * INV[n-i] % MOD
        tmp = (tmp * FACT[n-1] * INV[n-i-1] * INV[i]) % MOD
        ans = (ans + tmp) % MOD
    print(ans) def main():
    n, k = map(int, input().split())
    ans = 0
    for i in range(min(n-1, k)+1):
        # iCn
        # (n-i-1)C(n-1)
        tmp = FACT[n] * INV[i] * INV[n-i] % MOD
        tmp = (tmp * FACT[n-1] * INV[n-i-1] * INV[i]) % MOD
        ans = (ans + tmp) % MOD
    print(ans) main def div(a, b):
    return a * pow(b, MOD-2, MOD) % MOD def div(a, b):
    return a * pow(b, MOD-2, MOD) % MOD div FACT = [1] * (MAX+1) [1] * (MAX+1) FACT
MOD = 10**9 + 7
MAX = int(2e5)


def div(a, b):
    return a * pow(b, MOD-2, MOD) % MOD


FACT = [1] * (MAX+1)
for i in range(1, MAX+1):
    FACT[i] = (i * FACT[i-1]) % MOD
INV = [1] * (MAX+1)
INV[MAX] = div(1, FACT[MAX])
for i in range(MAX, 0, -1):
    INV[i-1] = (INV[i] * i) % MOD


def main():
    n, k = map(int, input().split())
    ans = 0
    for i in range(min(n-1, k)+1):
        # iCn
        # (n-i-1)C(n-1)
        tmp = FACT[n] * INV[i] * INV[n-i] % MOD
        tmp = (tmp * FACT[n-1] * INV[n-i-1] * INV[i]) % MOD
        ans = (ans + tmp) % MOD
    print(ans)


if __name__ == "__main__":
    main()
