Knapsack

각 종류의 추를 최대 두 개씩 사용해 총 질량이 W가 되는 선택의 수를 세는데, 다음 종류의 무게는 이전의 두 배 이상이다.

어려움8동적 계획법조합론아직 제출이 없습니다시간 제한3초메모리 제한512 MB

문제

There are nn types of weights. The mass of one weight of type i+1i+1 is not less than the mass of two weights of type ii. You have exactly 22 weights of each type.

Count the number of ways to select some weights with total mass equal to WW. Two ways are different if for some ii, the number of selected weights of type ii is different.

입력

In the first line of input, there are two integers nn and WW: the number of types and the desired total mass (1n601 \le n \le 60, 0W410180 \le W \le 4 \cdot 10^{18}).

In the second line of input, there are nn integers a_ia\_{i}: the masses of the weights. It is guaranteed that 1a_11 \le a\_{1}, 2a_ia_i+12 \cdot a\_{i} \le a\_{i+1}, and a_n1018a\_{n} \le 10^{18}.

출력

Print a single line containing the answer to the problem.