# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


MOD = int(1e09) + 7
# INF = int(1e15)


def solve():
    MAX = 2 * 10 ** 5 + 10
    fac = [0] * MAX
    inv = [0] * MAX
    finv = [0] * MAX
    fac[0] = fac[1] = finv[0] = finv[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 cmb(n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
    N, K = Scanner.map_int()
    ans = 0
    for i in range(min(N - 1, K) + 1):
        ans += cmb(N, i) * cmb(N - 1, i)
        ans %= MOD
    print(ans)


def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve()


if __name__ == "__main__":
    main() import sys sys import math math import os os import itertools itertools import string string import heapq heapq import _collections _collections from collections import Counter from collections import defaultdict from collections import deque from functools import lru_cache import bisect bisect import re re import queue queue import decimal decimal class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)] Scanner def int():
        return int(sys.stdin.readline().rstrip())

     int return int(sys.stdin.readline().rstrip()) int(sys.stdin.readline().rstrip()) int sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip @staticmethod
     int staticmethod int def string():
        return sys.stdin.readline().rstrip()

     string return sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip @staticmethod
     string staticmethod string def map_int():
        return [int(x) for x in Scanner.string().split()]

     map_int int(x) for x in Scanner.string().split() for x in Scanner.string().split() x Scanner.string().split() Scanner.string().split Scanner.string() Scanner.string Scanner string split for x in Scanner.string().split() int(x) int x return [int(x) for x in Scanner.string().split()] [int(x) for x in Scanner.string().split()] @staticmethod
     map_int staticmethod map_int def string_list(n):
        return [Scanner.string() for i in range(n)]

     string_list Scanner.string() for i in range(n) for i in range(n) i range(n) range n for i in range(n) Scanner.string() Scanner.string Scanner string return [Scanner.string() for i in range(n)] [Scanner.string() for i in range(n)] n n @staticmethod
     string_list staticmethod string_list def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

     int_list_list Scanner.map_int() for i in range(n) for i in range(n) i range(n) range n for i in range(n) Scanner.map_int() Scanner.map_int Scanner map_int return [Scanner.map_int() for i in range(n)] [Scanner.map_int() for i in range(n)] n n @staticmethod
     int_list_list staticmethod int_list_list def int_cols_list(n):
        return [Scanner.int() for i in range(n)] int_cols_list Scanner.int() for i in range(n) for i in range(n) i range(n) range n for i in range(n) Scanner.int() Scanner.int Scanner int return [Scanner.int() for i in range(n)] [Scanner.int() for i in range(n)] n n @staticmethod
     int_cols_list staticmethod int_cols_list MOD = int(1e09) + 7 MOD int(1e09) + 7 int(1e09) int 1e09 7 def solve():
    MAX = 2 * 10 ** 5 + 10
    fac = [0] * MAX
    inv = [0] * MAX
    finv = [0] * MAX
    fac[0] = fac[1] = finv[0] = finv[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 cmb(n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
    N, K = Scanner.map_int()
    ans = 0
    for i in range(min(N - 1, K) + 1):
        ans += cmb(N, i) * cmb(N - 1, i)
        ans %= MOD
    print(ans) solve MAX = 2 * 10 ** 5 + 10 MAX 2 * 10 ** 5 + 10 2 * 10 ** 5 2 10 ** 5 10 5 10 fac = [0] * MAX fac [0] * MAX [0] 0 MAX inv = [0] * MAX inv [0] * MAX [0] 0 MAX finv = [0] * MAX finv [0] * MAX [0] 0 MAX fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1 fac[0] fac 0 1 = fac[1] = finv[0] = finv[1] = inv[1] = 1 fac[1] fac 1 1 finv[0] finv 0 finv[1] finv 1 inv[1] inv 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 def cmb(n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
     cmb if n < k:
            return 0
         n < k n k return 0 0 if n < 0 or k < 0:
            return 0
         n < 0 or k < 0 n < 0 n 0 k < 0 k 0 return 0 0 return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD fac[n] * (finv[k] * finv[n - k] % MOD) % MOD fac[n] * (finv[k] * finv[n - k] % MOD) fac[n] fac n finv[k] * finv[n - k] % MOD finv[k] * finv[n - k] finv[k] finv k finv[n - k] finv n - k n k MOD MOD n n k k N, K = Scanner.map_int() N Scanner.map_int() Scanner.map_int Scanner map_int K ans = 0 ans 0 for i in range(min(N - 1, K) + 1):
        ans += cmb(N, i) * cmb(N - 1, i)
        ans %= 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 ans += cmb(N, i) * cmb(N - 1, i) ans cmb(N, i) * cmb(N - 1, i) cmb(N, i) cmb N i cmb(N - 1, i) cmb N - 1 N 1 i ans %= MOD ans MOD print(ans) print ans def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve() main solve() solve if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)] class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)] Scanner def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve() def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve() main def solve():
    MAX = 2 * 10 ** 5 + 10
    fac = [0] * MAX
    inv = [0] * MAX
    finv = [0] * MAX
    fac[0] = fac[1] = finv[0] = finv[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 cmb(n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
    N, K = Scanner.map_int()
    ans = 0
    for i in range(min(N - 1, K) + 1):
        ans += cmb(N, i) * cmb(N - 1, i)
        ans %= MOD
    print(ans) def solve():
    MAX = 2 * 10 ** 5 + 10
    fac = [0] * MAX
    inv = [0] * MAX
    finv = [0] * MAX
    fac[0] = fac[1] = finv[0] = finv[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 cmb(n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
    N, K = Scanner.map_int()
    ans = 0
    for i in range(min(N - 1, K) + 1):
        ans += cmb(N, i) * cmb(N - 1, i)
        ans %= MOD
    print(ans) solve MOD = int(1e09) + 7 int(1e09) + 7 MOD
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import lru_cache
import bisect
import re
import queue
import decimal


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


MOD = int(1e09) + 7
# INF = int(1e15)


def solve():
    MAX = 2 * 10 ** 5 + 10
    fac = [0] * MAX
    inv = [0] * MAX
    finv = [0] * MAX
    fac[0] = fac[1] = finv[0] = finv[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 cmb(n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
    N, K = Scanner.map_int()
    ans = 0
    for i in range(min(N - 1, K) + 1):
        ans += cmb(N, i) * cmb(N - 1, i)
        ans %= MOD
    print(ans)


def main():
    # sys.setrecursionlimit(1000000)
    # sys.stdin = open("sample.txt")
    # T = Scanner.int()
    # for _ in range(T):
    #     solve()
    # print('YNeos'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()
