import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    int N, K;
    scan(N, K);
    K = min(K, N - 1);
    Mint ans;
    auto mc = ModComb(N);
    foreach (i ; 0 .. K + 1) {
        ans += mc.c(N, i) * mc.c(N - 1, i);
    }
    writeln(ans);
}


enum mod = 1_000_000_007L;

struct Mint {
    long x;

    this(long a) {
        x = a % mod;
        if (x < 0) x += mod;
    }

    this(Mint a) {
        x = a.x;
    }

    ref Mint opAssign(long a) {
        this = Mint(a);
        return this;
    }

    ref Mint opOpAssign(string op)(Mint rhs) {
        static if (op == "+") {
            x += rhs.x;
            if (x >= mod) x -= mod;
        }
        static if (op == "-") {
            x -= rhs.x;
            if (x < 0) x += mod;
        }
        static if (op == "*") {
            (x *= rhs.x) %= mod;
        }
        static if (op == "/") {
            this *= rhs.inv();
        }
        return this;
    }

    ref Mint opOpAssign(string op)(long rhs) {
        static if (op == "^^") {
            this = powmod(this, rhs);
            return this;
        }
        else {
            return mixin("this " ~ op ~ "= Mint(rhs)");
        }
    }

    const Mint powmod(Mint a, long b) {
        Mint res = 1, p = a;
        while (b > 0) {
            if (b & 1) res *= p;
            p *= p;
            b /= 2;
        }
        return res;
    }

    const Mint inv() {
        return powmod(this, mod - 2);
    }

    Mint opUnary(string op)() if (s == "-") {
        return Mint(-x);
    }

    Mint opBinary(string op, T)(const T rhs) {
        return mixin("Mint(this) " ~ op ~ "= rhs");
    }

    Mint opBinaryRight(string op)(const long rhs) {
        return mixin("Mint(rhs) " ~ op ~ "= this");
    }

    bool opEquals(Mint a, Mint b) {
        return a.x == b.x;
    }

    bool opEquals(long rhs) {
        long y = rhs % mod;
        if (y < 0) y += mod;
        return x == y;
    }

    string toString() {
        import std.conv : to;
        return x.to!string;
    }
}

struct ModComb {
    int N;
    Mint[] fact, ifact;

    this(int n) {
        N = n;
        fact = new Mint[](N + 1);
        ifact = new Mint[](N + 1);

        fact[0] = 1;
        foreach (i ; 1 .. N + 1) {
            fact[i] = fact[i - 1] * i;
        }

        ifact[N] = 1 / fact[N];
        foreach_reverse (i ; 0 .. N) {
            ifact[i] = ifact[i + 1] * (i + 1);
        }
    }

    Mint c(int n, int k) {
        if (n < 0 || k < 0 || k > n) return Mint(0);
        return fact[n] * ifact[n - k] * ifact[k];
    }

    Mint p(int n, int k) {
        if (n < 0 || k < 0 || k > n) return Mint(0);
        return fact[n] * ifact[n - k];
    }
}

unittest {
    auto mc = ModComb(1_000_000);
    assert(mc.c(5, 2) == 10);
    assert(mc.c(6, 3) == 20);
    assert(mc.c(3, 1) == 3);
    assert(mc.c(0, 0) == 1);
    assert(mc.c(3, 4) == 0);
    assert(mc.c(3, -1) == 0);
    assert(mc.c(-1, 0) == 0);
    assert(mc.c(40, 20) == 846527861);

    assert(mc.p(5, 2) == 20);
    assert(mc.p(6, 3) == 120);
    assert(mc.p(3, 1) == 3);
    assert(mc.p(0, 0) == 1);
    assert(mc.p(3, 4) == 0);
    assert(mc.p(3, -1) == 0);
}


void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}
