NIO is the boss of the watch shop. One day, he wants to purchase a batch of watches from the manufactory. However, he lives in Amefica(not a real country), a country in is heavily taxed. If he buys k watches, the i-th (starts from 1) watch in his list will cost him ai (the original price) plus k×i dollars (the i-th one in the original list) . Now NIO only has M dollars, so NIO asks you how many watches he can purchase actually.