After solving all the problems at the competition, you decide to play a game of solitaire on your computer. You have playing cards, each uniquely numbered from to . The game board consists of cells, numbered from to from left to right.
Your task is to place each card into one of these cells, following these rules:
Card must be positioned exactly D_1 cells to the left or right of card .
Card must be positioned exactly D_2 cells to the left or right of card .
...
Card must be positioned exactly D_N cells to the left or right of card .
You need to determine the number of distinct ways to arrange the cards on the board. Note that any number of cards can occupy a single cell.
The first line contains two integers and , separated by a space (2 < N < 36, 1 < M < 1\ 000\ 000).The second line contains integers D_1, D_2, \ldots, D_N, also separated by spaces (1 < D_j < 10\ 000 for each ).
Output the number of distinct ways to arrange the cards according to the rules.
Example 1
Example 2
In the first example, the following arrangements are possible:
— — — —
— — — —
— — — —
— — — —
— — — —
— — — —
— — — —
— — — —