#include <bits/stdc++.h>
using namespace std;
using vi = vector<long long>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vp = vector<pair<long long, long long> >;
using vvp = vector<vp>;
using vb = vector<bool>;
const long long inf = 1001001001001001;
const int INF = 1001001001;
const int mod = 1000000007;
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
void out(T a) {
  cout << a << '\n';
}
template <class T>
void outp(T a) {
  cout << '(' << a.first << ',' << a.second << ')' << '\n';
}
template <class T>
void outvp(T v) {
  for (long long i = 0; i < (long long)(v.size()); i++) outp(v[i]);
}
template <class T>
void outv(T v) {
  for (long long i = 0; i < (long long)(v.size()); i++) {
    if (i) cout << ' ';
    cout << v[i];
  }
  cout << '\n';
}
template <class T>
void outvv(T v) {
  for (long long i = 0; i < (long long)(v.size()); i++) {
    for (long long j = 0; j < (long long)(v[i].size()); j++) {
      if (j) cout << ' ';
      cout << v[i][j];
    }
    cout << '\n';
  }
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long modpow(long long a, long long b) {
  a %= mod;
  if (b == 0) return 1;
  if (b & 1) return a * modpow(a, b - 1) % mod;
  long long k = modpow(a, b / 2);
  return k * k % mod;
}
int main() {
  long long n, s;
  cin >> n >> s;
  long long ans = 0;
  vi dp(s + 1);
  vi v(n);
  for (long long i = 0; i < (long long)(n); i++) cin >> v[i];
  for (long long i = 0; i < (long long)(n); i++) {
    vi ndp = dp;
    if (v[i] <= s) ndp[v[i]] += i + 1;
    for (long long j = 0; j < (long long)(s + 1); j++)
      if (j + v[i] <= s) ndp[j + v[i]] += dp[j];
    dp = ndp;
    ans += dp[s];
  }
  out(ans);
}
