#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
vector<vector<long long int> > solve(long long int n, long long int s,
                                     long long int pos = 0) {
  if (s == 0) {
    vector<vector<long long int> > x;
    x.push_back(vector<long long int>());
    return x;
  }
  if (pos == n) return vector<vector<long long int> >();
  vector<vector<long long int> > arr = solve(n, s, pos + 1);
  vector<vector<long long int> > arr2 = solve(n, s - v[pos], pos + 1);
  for (auto &it : arr2) {
    if (it.size() < 2)
      it.push_back(pos);
    else
      it[1] = pos;
    arr.push_back(it);
  }
  return arr;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  register long long int i, j, num, t = 1;
  while (t--) {
    long long int n, s;
    cin >> n >> s;
    v.resize(n);
    for (long long int &x : v) cin >> x;
    vector<vector<long long int> > arr = solve(n, s);
    long long int ans = 0;
    for (auto x : arr) {
      ans += (x.back() - 0 + 1) * (n - x.front());
    }
    cout << ans << endl;
  }
  return 0;
}
