Problem:
Score : 500 points

Problem Statement

There is a building with n rooms, numbered 1 to n.

We can move from any room to any other room in the building.

Let us call the following event a move: a person in some room i goes to another room j~ (i \neq j).

Initially, there was one person in each room in the building.

After that, we know that there were exactly k moves happened up to now.

We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible?

Find the count modulo (10^9 + 7).

Constraints

All values in input are integers.

3 \leq n \leq 2 \times 10^5

2 \leq k \leq 10^9

Input

Input is given from Standard Input in the following format:

n k

Output

Print the number of possible combinations of numbers of people in the n rooms now, modulo (10^9 + 7).

Sample Input 1

3 2

Sample Output 1

10

Let c_1, c_2, and c_3 be the number of people in Room 1, 2, and 3 now, respectively. There are 10 possible combination of (c_1, c_2, c_3):

(0, 0, 3)

(0, 1, 2)

(0, 2, 1)

(0, 3, 0)

(1, 0, 2)

(1, 1, 1)

(1, 2, 0)

(2, 0, 1)

(2, 1, 0)

(3, 0, 0)

For example, (c_1, c_2, c_3) will be (0, 1, 2) if the person in Room 1 goes to Room 2 and then one of the persons in Room 2 goes to Room 3.

Sample Input 2

200000 1000000000

Sample Output 2

607923868

Print the count modulo (10^9 + 7).

Sample Input 3

15 6

Sample Output 3

22583772

Solution in Rust (1.15.1) (judge verdict: Runtime Error)

// This code is generated by [cargo-atcoder](https://github.com/tanakh/cargo-atcoder)
// Original source code:
/*
#[allow(unused_imports)]
use itertools::Itertools as _;
use proconio::input;
#[allow(unused_imports)]
use procontools::{dp, p};
#[allow(unused_imports)]
use std::cmp::*;

#[allow(non_upper_case_globals)]
const prime: u64 = 1_000_000_007;
use std::ops::*;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ModInt(u64);
impl ModInt {
    pub fn new(i: u64) -> Self {
        ModInt(i % prime)
    }
    pub fn inv(self) -> Self {
        debug_assert!(procontools::math::gcd(*self, prime) == 1);
        debug_assert!(*self != 0);
        self.pow(prime - 2)
    }
    pub fn pow(self, pow: u64) -> Self {
        let mut pow = pow;
        pow %= prime - 1;
        if pow == 0 {
            ModInt(1)
        } else if pow % 2 == 0 {
            let h = self.pow(pow >> 1);
            h * h
        } else {
            let h = self.pow(pow >> 1);
            h * h * self
        }
    }
}
impl Deref for ModInt {
    type Target = u64;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl Add for ModInt {
    type Output = Self;
    fn add(self, other: Self) -> Self::Output {
        ModInt((*self + *other) % prime)
    }
}
impl Sub for ModInt {
    type Output = Self;
    fn sub(self, other: Self) -> Self::Output {
        if *self > *other {
            ModInt(*self - *other)
        } else {
            ModInt(*self + prime - *other)
        }
    }
}
impl Mul for ModInt {
    type Output = Self;
    fn mul(self, other: Self) -> Self::Output {
        ModInt(*self * *other % prime)
    }
}
impl Div for ModInt {
    type Output = Self;
    fn div(self, other: Self) -> Self::Output {
        self * other.inv()
    }
}
fn f(n: ModInt, k: ModInt) -> ModInt {
    (1..=k.0)
        .map(|i| (n - ModInt(i - 1)) / ModInt(i))
        .fold(ModInt(1), |p, x| p * x)
}
fn main() {
    input! {
        n:usize,k:usize
    }
    //ignore k
    if k > n - 1 {
        p!(*f(ModInt(n as u64) + ModInt(k as u64), ModInt(n as u64)) % prime);
        return;
    }
    panic!()
}
*/

fn main() {
    let exe = "/tmp/binD08006DA";
    std::io::Write::write_all(&mut std::fs::File::create(exe).unwrap(), &decode(BIN)).unwrap();
    std::fs::set_permissions(exe, std::os::unix::fs::PermissionsExt::from_mode(0o755)).unwrap();
    std::process::exit(std::process::Command::new(exe).status().unwrap().code().unwrap())
}

fn decode(v: &str) -> Vec<u8> {
    let mut ret = vec![];
    let mut buf = 0;
    let mut tbl = vec![64; 256];
    for i in 0..64 { tbl[TBL[i] as usize] = i as u8; }
    for (i, c) in v.bytes().filter_map(|c| { let c = tbl[c as usize]; if c < 64 { Some(c) } else { None } }).enumerate() {
        match i % 4 {
            0 => buf = c << 2,
            1 => { ret.push(buf | c >> 4); buf = c << 4; }
            2 => { ret.push(buf | c >> 2); buf = c << 6; }
            3 => ret.push(buf | c),
            _ => unreachable!(),
        }
    }
    ret
}

const TBL: &'static [u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const BIN: &'static str = "<base64-encoded ELF executable removed>";