#Lutece0194. Money Systems

Money Systems

Migrated from Lutece 194 Money Systems

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

The cows have not only created their own government but they have chosen to create their own money system. In their own rebellious way, they are curious about values of coinage. Traditionally, coins come in values like 11, 55, 1010, 2020 or 2525, 5050, and 100100 units, sometimes with a 22 unit coin thrown in for good measure.

The cows want to know how many different ways it is possible to dispense a certain amount of money using various coin systems. For instance, using a system of {1,2,5,10,}\{1, 2, 5, 10, \cdots \} it is possible to create 1818 units several different ways, including: 18×118\times 1, 9×29\times 2, 8×2+2×18\times 2+2\times 1, 3×5+2+13\times 5+2+1, and many others.

Write a program to compute how many ways to construct a given amount of money using supplied coinage. It is guaranteed that the total will fit into both a signed long long (C/C++) and Long (Java).

Input

The number of coins in the system is VV (1V251\leq V\leq 25).

The amount money to construct is NN (1N10,0001\leq N\leq 10,000).

Line 11: Two integers, VV and NN

Lines 22\cdots : VV integers that represent the available coins (no particular number of integers per line)

Output

A single line containing the total number of ways to construct NN money units using VV coins.

Samples

3 10
1 2 5
10

Resources

USACO TRAINING selected by rectaflex