#include <iostream>
#include <vector>
using namespace std;
int main() {
long long n, m;
cin >> n >> m;
vector<long long> coins(n);
for (long long i = 0; i < n; ++i) {
cin >> coins[i];
}
vector<long long> dp(m + 1, 0);
dp[0] = 1;
for (long long j = 0; j < n; ++j) {
for (long long i = coins[j]; i <= m; ++i) {
dp[i] += dp[i - coins[j]];
}
}
cout << dp[m] << endl;
return 0;
}