#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int main() {
  int N, S, A[3000], B[30][3001] = {0}, sum[3000], ans = 0;
  cin >> N >> S;
  for (int i = 0; i < N; i++) cin >> A[i];
  B[0][A[0]]++;
  for (int i = 0; i < N - 1; i++) {
    for (int j = 1; j <= 3000; j++) {
      B[i + 1][j] = B[i][j];
      if (j - A[i] > 0) B[i + 1][j] += B[i][j - A[i]];
    }
  }
  for (int i = 0; i < N; i++) ans += B[i][S];
  cout << ans;
  return 0;
}
