#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long a[10005];
int main() {
  long long n, s, count = 0;
  scanf("%d", &n);
  ;
  scanf("%d", &s);
  ;
  for (int i = 1; i <= n; ++i) {
    long long u;
    scanf("%lld", &u);
    ;
    for (int j = s - 1; j >= 0; --j) {
      if (j == 0)
        a[u] += i;
      else if (a[j] != 0 && j + u <= s)
        a[j + u] += a[j];
    }
    count += a[s] * (n - i + 1);
    a[s] = 0;
  }
  printf("%lld\n", count);
}
