#include <bits/stdc++.h>
const long long int MOD = 1e9 + 7;
const long long int INF = 1011111111;
const long long int LLINF = 1000111000111000111LL;
const long double EPS = 1e-10;
const long double PI = 3.14159265358979323;
using namespace std;
long long int power(long long int base, long long int exponent) {
  long long int ans = 1;
  while (exponent != 0) {
    if (exponent & 1) ans = (1LL * ans * base);
    base = (1LL * base * base);
    exponent >>= 1;
  }
  return ans;
}
long long int n, sum;
long long int ar[3005];
long long int dp[3005][3005];
long long int solve(long long int idx, long long int ss) {
  if (idx >= n) {
    return 0;
  }
  if (dp[idx][ss] != -1) return dp[idx][ss];
  long long int ans = 0;
  if (ar[idx] == ss) {
    ans = n - idx + solve(idx + 1, ss);
  } else if (ar[idx] < ss) {
    ans = solve(idx + 1, ss) + solve(idx + 1, ss - ar[idx]);
  } else {
    ans = solve(idx + 1, ss);
  }
  return dp[idx][ss] = ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> sum;
  memset(dp, -1, sizeof dp);
  for (long long int i = 0; i < n; i++) cin >> ar[i];
  long long int f = 0;
  for (long long int i = 0; i < n; i++) {
    f += solve(i, sum);
  }
  cout << f << '\n';
  cerr << '\n'
       << "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms"
       << '\n';
}
