#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  int fh = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= fh;
}
template <typename T>
void write(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writeln(T x) {
  write(x);
  puts("");
}
int n, s, a[3005];
int dp[3005][3005];
vector<pair<int, int> > vec;
void get(int i, int j, int mx, int mn) {
  if (j == 0) {
    vec.push_back(make_pair(mn, mx));
    return;
  }
  if (i == 0) return;
  if (j >= a[i]) {
    get(i - 1, j, mx, mn);
    get(i - 1, j - a[i], max(mx, i), min(mn, i));
  } else
    get(i - 1, j, mx, mn);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= s; j++)
      if (j >= a[i])
        dp[i][j] += dp[i - 1][j] + dp[i - 1][j - a[i]];
      else
        dp[i][j] += dp[i - 1][j];
  get(n, s, 0, 1000000007);
  int ans = 0;
  for (int i = 0; i < vec.size(); i++)
    ans += vec[i].first * (n - vec[i].second + 1);
  cout << ans << endl;
  return 0;
}
