Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/kombinatorika-konfetlarni-taqsimlash

Distributing candies

Medium 1000 ms 128 MB 51%
Share

$n$ identical candies must be distributed among $k$ children. Every candy goes to someone, but some children may get none. Two distributions are different if at least one child gets a different number of candies in them. In how many ways can the candies be distributed? Print the answer modulo $10^{9} + 7$.

A row of candies and the dividers splitting them among the children

Input

One line with two integers: $n$ and $k$.

Output

One integer — the number of ways modulo $10^{9} + 7$.

Note

$0 \le n \le 10^{6}$
$1 \le k \le 10^{6}$

Examples

Input #1
4 3
Output #1
15
Input #2
5 1
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.