#Lutece3330. Network

Network

Description

Connecting a network and keeping it stable is never an easy task. While achieving minimum connectivity is not a challenge, the real-world network environment is often quite complex -- damaged lines, equipment failures, and malicious attacks can all contribute to a decrease in network communication capabilities or even complete collapse. When designing a computer network, these factors should all be taken into account. However, due to limited resources such as manpower and materials, it is often necessary to choose a compromise solution between stability and cost.

Two devices are connected (or able to communicate with each other) if and only if either of the following conditions is met:

  1. The two devices are directly connected by any connection without fault;
  2. There is a third device that connects with both of these two devices.

Now we have a network containing NN devices, and fiber optic connections will be used between each pair of devices (there can be any number of connections between any pair, including zero). However, the fiber optic connections are not always reliable. We need to ensure that with no more than any kk connections being faulty, any two devices in the network can still communicate with each other. How many connections do we need at least among these NN devices under the requirement?

Input

The input file contains only one line with two integers N (1N2×109)N\ (1\le N\le 2\times 10^9) and k (0k2×109)k\ (0\le k\le 2\times 10^9), as described above.

Output

Output the minimum number of fiber optic connections required. Note that the answer may NOT fit in 32-bit signed integer.

Samples

1 0
0
4 1
4
4 2
6
3 3
6
101 101
5151

Note

For the second example, these devices remain connected with any connection being faulty if we connect them as below.

Resources

电子科技大学第十四届 ACM 趣味程序设计竞赛