AtCoder Grand Contest 065
D
Not Intersect
AtCoder
⌀ 3117
原题
← CE →
翻译中…

Problem Statement

翻译中…

There is a circle on a plane. It has $N$ distinct points on its circumference, numbered $1,2,\dots,N$ in clockwise order.

翻译中…

There are $\frac{N(N-1)}{2}$ line segments that can be drawn by connecting two different points among the $N$ points; you will choose and draw $M$ of these segments. Find the number, modulo $(10^9+7)$, of ways to draw $M$ segments such that no two of them intersect at a point other than their endpoints.

翻译中…

Constraints

翻译中…
  • $1 \le N \le 10^7$
  • $0 \le M \le \frac{N(N-1)}{2}$
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N M

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
4 2
Output #1
14
The following examples on the left and in the middle satisfy the conditions. (Note that it is acceptable for the segments to intersect at their endpoints.) The example on the right is unsuitable because two edges intersect at a point other than their endpoints. All other $\binom{6}{2} - 1 = 14$ ways satisfy the conditions. ![image](https://img.atcoder.jp/agc065/4854b47261fd9c54c2d25ee53c3e6be5.png)
Input #2
6 3
Output #2
295
Input #3
2023 1217
Output #3
10811951
Input #4
1234321 2345432
Output #4
789452255
题目信息
题号
agc065_d
时间限制
3 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。