Candy Shopping (Contest)
Candy Shopping easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Candy Shopping easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
There are N candies, ith of them costing pi. You have M amount of money with you. Find the maximum number of candies you can buy. Input The first line of the input contains two integers N and M. The second line of the input contains N space seperated integers.
Constraints: 1 <= N <= 105 1 <= M <= 1014 1 <= pi <= 109 Output Print the maximum number of candies you can buy. Example Sample Input: 4 7 3 1 4 2
Sample Output: 3
link: