P23440 [AtCoder] Not Intersect
省选
题目描述

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.

Input

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

Output

Print the answer.

Constraints

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

Sample Input 1

4 2

Sample 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.

Sample Input 2

6 3

Sample Output 2

295

Sample Input 3

2023 1217

Sample Output 3

10811951

Sample Input 4

1234321 2345432

Sample Output 4

789452255

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 2
样例输出
14