#include <bits/stdc++.h>
int main(void) {
  long long i, j, k, n, s, ans = 0;
  scanf("%lld%lld", &n, &s);
  long long a, dp[s];
  for (i = 0; i < s; ++i) dp[i] = 0;
  dp[0] = 1;
  for (i = 0; i < n; ++i) {
    scanf("%lld", &a);
    if (s >= a) ans += dp[s - a] * (n - i);
    if (a < s)
      for (j = s - a - 1; j >= 0; --j) dp[j + a] += dp[j];
    dp[0]++;
  }
  printf("%lld", ans);
  return 0;
}
