Time

13:07:03
23 May 2012
Version for print

Pirates and coins

   n pirates fairly divided the treasure of m gold coins - everyone got his part according to their rank and seniority pirate. Youngest pirate took a coin and each pirate taking on the next one coin more than the previous colleague. The last was the captain, who got twice as much of the plan, it is obvious that after the coins are no more.

   How many pirates along with the captain, if we know a and m. Since the captain without a team just a pirate, then n > 1.


Specifications

   Input

   Two positive integers a and m (1 a 100, m < 15150). Input values are correct.

   Output

   The number of pirates n.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 10
Complexity: 8% 564/613

Example

Example input

5 25

Example output

3


← Spider and Fly - 2 Problems New case →