Gimme Gimme More


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python

After a long and successful career as a competitive-programmer-turned-goose-farmer, you have more money than you know what to do with in your retirement. You decide to bestow some of your savings to your children. However, over time, due to your bad habits, you have also accumulated quite a few children.

Your favourite child is your youngest child, Maged Jr, but your other children will surely complain if you give him more money than them. Specifically, in order to keep your children happy, each child must receive a positive integer number of dollars, and each child must receive strictly more money than their immediate younger sibling.

Given you want to distribute k dollars among n children, what is the most money you can give your youngest child while keeping your children happy?

If it is not possible to fulfil your children's demands, output -1 to let them know they are being unreasonable.

Input

The input consists of a single line containing two integers n and k (1 \leq n, k \leq 10^6), representing the number of children, and the total amount of money you will pass down to them.

Output

Output the highest integer amount of money you can pay your youngest child while keeping all children happy according to the above property. Assume no children have exactly the same age (i.e. there are no twins, etc.). If it is impossible, output -1.

Examples

Input 1
1 7
Output 1
7

With only one child, the youngest is the only child and can receive all 7 dollars.

Input 2
3 8
Output 2
1

There are three children. To give the youngest 1 dollar, we can distribute 1,2,3 dollars from youngest to oldest, which preserves the property and takes 6 dollars. There are not enough dollars left over (2) to give the youngest child any more money; we can only make distributions such as 1,2,5 or 1,3,4.

Input 3
4 5
Output 3
-1

It is impossible to give 4 children positive integer amounts while preserving the property and having only 5 dollars. The minimum valid distribution would be 1,2,3,4 from youngest to oldest, which requires 10 dollars.

Input 4
7 50
Output 4
4
Input 5
1000 566500
Output 5
67

Comments

There are no comments at the moment.