#include<bits/stdc++.h>

#ifdef _PRINTDEBUG
  #include "lib/printdebug.hpp"
#else
  #define printdebug(...) 1
#endif
#define I_1000000007 (1000000007)
#define I_998244353   (998244353)
#define I_INF             (1<<28)
#define L_INF           (1LL<<60)
#define rep(i, n)      REP(i, 0, (n))
#define repc(i, n)     REPC(i, 0, (n))
#define REP(i, n, m)   for (int i = (int)(n); i <  (int)(m); i++)
#define REPC(i, n, m)  for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
#define yesno(cond)       YESNO((cond), "Yes", "No")
#define YESNO(cond, a, b) cout << ((cond) ? (a) : (b)) << "\n"
template<class T> inline bool chmin(T& a, const T& b) {
  if (a > b) { a = b; return true; } else return false;
}
template<class T> inline bool chmax(T& a, const T& b) {
  if (a < b) { a = b; return true; } else return false;
}
template<std::int_fast64_t divisor> struct modint {
  using i64 = std::int_fast64_t;

  i64 val;

  constexpr modint(i64 v = 0) noexcept : val(v % divisor) {
    if (val < 0) val += divisor;
  }

  constexpr modint operator + (const modint& rhs) const noexcept {
    return modint(*this) += rhs;
  }

  constexpr modint operator - (const modint& rhs) const noexcept {
    return modint(*this) -= rhs;
  }

  constexpr modint operator * (const modint& rhs) const noexcept {
    return modint(*this) *= rhs;
  }

  constexpr modint operator / (const modint& rhs) const noexcept {
    return modint(*this) /= rhs;
  }

  constexpr modint operator ~ () const noexcept {
    i64 a = this->val, b = divisor, u = 1, v = 0;
    while (b > 0) {
      i64 t = a / b;
      a -= t * b;
      u -= t * v;
      i64 c = a; a = b; b = c;
      i64 w = u; u = v; v = w;
    }
    if (u < 0) u += divisor;
    u %= divisor;
    return u;
  }

  constexpr modint& operator += (const modint& rhs) noexcept {
    val += rhs.val;
    if (val >= divisor) val -= divisor;
    return *this;
  }

  constexpr modint& operator -= (const modint& rhs) noexcept {
    if (val < rhs.val) val += divisor;
    val -= rhs.val;
    return *this;
  }

  constexpr modint& operator *= (const modint& rhs) noexcept {
    val = val * rhs.val % divisor;
    return *this;
  }

  constexpr modint& operator /= (const modint& rhs) noexcept {
    val = val * (~(modint(rhs))).val % divisor;
    return *this;
  }
};
namespace combinatorics {
  const int limit = 1000010;
  const int mod = 1000000007;

  bool initialized = false;
  long long fac_table[limit], inv_table[limit], finv_table[limit];

  void initialize() {
    fac_table[0] = fac_table[1] = 1;
    inv_table[1] = 1;
    finv_table[0] = finv_table[1] = 1;
    for (int i = 2; i < limit; i++) {
      fac_table[i] = fac_table[i - 1] * i % mod;
      inv_table[i] = mod - inv_table[mod % i] * (mod / i) % mod;
      finv_table[i] = finv_table[i - 1] * inv_table[i] % mod;
    }
    initialized = true;
  }

  long long com(int n, int k) {
    if (!initialized) initialize();
    if (n < k || n < 0 || k < 0) return 0;
    else return fac_table[n] * (finv_table[k] * finv_table[n - k] % mod) % mod;
  }
}

namespace solver {
  using namespace std;
  using ll = long long;
  using mint = modint<I_1000000007>;

  int N, K;

  void init() {
    cin >> N >> K;
  }

  void solve() {
    mint ans = 0;
    repc(i, min(N-1, K)) {
      mint a1 = combinatorics::com(N-1, N-i-1);
      mint a2 = combinatorics::com(N, i);
      ans += a1 * a2;
    }
    cout << ans.val << "\n";
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  solver::init();
  solver::solve();
  return 0;
}

Measured memory_bytes: 23680