#include <bits/stdc++.h>
using namespace std;
const long long N = 100005;
signed main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, s;
  cin >> n >> s;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long dp[s + 1];
  memset(dp, 0, sizeof(dp));
  long long ans = 0;
  dp[0] = 1;
  if (arr[0] <= s) dp[arr[0]] = 1;
  for (long long i = 1; i < n; i++) {
    if (arr[i] <= s) dp[arr[i]]++;
    for (long long j = 1; j <= (s - arr[i]); j++) {
      dp[j + arr[i]] += dp[j];
    }
    ans += dp[s];
  }
  cout << ans;
  return 0;
}
