|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||1024 MB||91||21||19||29.231%|
This year the Ice Hockey World Championship took place in the Czech Republic. Bobek has arrived in Prague and he would like to visit some of the matches. He does not have any team preferences and he does not have any time restrictions. If he had enough money, he would be able to visit all of the matches. Unfortunately, he has only a limited number of Czech crowns, all of which can be spent on tickets. Knowing how much a ticket costs for each match, calculate the number of ways he can attend a set of matches without exceeding his budget. Two ways are considered different if there exists a match which is visited in one of the ways, but not visited in the other.
A description of Bobek’s situation is read from the standard input. The first line of input contains two positive integers N and M (1 ≤ N ≤ 40, 1 ≤ M ≤ 1018), denoting the number of matches and the number of Czech crowns Bobek can spend. The second line contains N space-separated positive integers, none of them exceeding 1016, representing costs of the matches in Czech crowns.
Output a single line with the number of ways Bobek can visit the matches. Please note that due to the limit on N, this number will be at most 240.
5 1000 100 1500 500 500 1000
The eight possible ways are: