#B3670. The Cutest Cinnamon Dog Doll
The Cutest Cinnamon Dog Doll
The Cutest Cinnamon Dog Doll
In a store, there are \(n\) Cinnamon Dog dolls. Each doll has a cuteness \(k\) and a price \(p\). A doll with a higher \(k\) is cuter. Given that someone has \(R\) money, determine the maximum cuteness \(k\) of a doll that can be bought.
Note: It is guaranteed that at least one doll can be bought.
inputFormat
The first line contains two integers \(n\) and \(R\) --- the number of dolls and the available money, respectively.
Each of the next \(n\) lines contains two integers \(k\) and \(p\), representing the cuteness and the price of a doll.
outputFormat
Output a single integer --- the maximum cuteness \(k\) among the dolls that can be bought with \(R\) money.
sample
3 10
5 6
8 10
7 11
8