#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x %= p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long po(long long base, long long powerRaised) {
  if (powerRaised != 0)
    return (base * po(base, powerRaised - 1));
  else
    return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, s;
  cin >> n >> s;
  vector<long long> v;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    v.push_back(x);
  }
  long long dp[n + 1][s + 1];
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= s; j++) dp[i][j] = 0;
  for (int i = 0; i < n; i++) dp[i + 1][v[i]] = i + 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= s; j++) {
      for (int k = 1; k < i; k++)
        if (j >= v[i - 1]) dp[i][j] += dp[k][j - v[i - 1]];
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans += (dp[i][s] * (n - i + 1));
  cout << ans;
  return 0;
}
