#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 200000;
const long long INF = 1001001001;
const long long MOD = 998244353;
long long N, S, ans = 0, tmp = 0;
vector<long long> A;
vector<vector<long long>> DP;
signed main() {
  cin >> N >> S;
  DP.resize(N + 1);
  for (long long i = 0; i < N + 1; i++) {
    DP[i].resize(S + 1, 0);
    DP[i][0] = 1;
  }
  for (long long i = 0; i < N; i++) {
    long long a;
    cin >> a;
    A.push_back(a);
  }
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j <= S; j++) {
      DP[i + 1][j] += DP[i][j];
      if (j >= A[i]) DP[i + 1][j] += DP[i][j - A[i]];
    }
    ans += DP[i + 1][S];
  }
  cout << ans << endl;
  return 0;
}
