P3910 Commemorative Stamps

Description

The post office has recently released a set of commemorative stamps. There are $N$ stamps in this set, each with a different face value, in order $1$ cent, $2$ cents, …, $N$ cents. Xiaoming is a stamp collector. He likes this set very much, but he only has $M$ cents, which is not enough to buy the whole set. However, he wants to spend exactly all his money. As a collector, he also does not want the stamp numbers to be discontinuous, so he plans to buy $b-a+1$ consecutive stamps with values from $a$ cents to $b$ cents, and the total value is exactly $M$ cents. Your task is to find all valid plans and output them in the form $\left[a,b\right]$.

Input Format

The input consists of a single line containing two integers $N$ and $M$ ($1 \le N, M \le 10^9$), separated by a space.

Output Format

Output each valid plan on a separate line as $\left[a,b\right]$, in increasing order of $a$.

Explanation/Hint

Translated by ChatGPT 5