#include <bits/stdc++.h>
using namespace std;
int calc(int* A, int S, int L, int R);
int main(void) {
  int N, S;
  cin >> N >> S;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int retval = 0;
  for (int L = 1; L <= N; L++) {
    for (int R = L; R <= N; R++) {
      retval += calc(A, S, L, R) % 998244353;
    }
  }
  cout << retval % 998244353 << endl;
  return 0;
}
int calc(int* A, int S, int L, int R) {
  L--;
  R--;
  int num = R - L + 1;
  int table[num][S + 1];
  for (int i = 0; i < num; i++) {
    for (int j = 0; j <= S; j++) {
      table[i][j] = 0;
    }
    table[i][0] = 1;
  }
  if (A[L] <= S) {
    table[0][A[L]] = 1;
  }
  for (int i = 1; i < num; i++) {
    for (int j = 0; j <= S; j++) {
      table[i][j] = table[i - 1][j];
      if (A[L + i] <= j) {
        table[i][j] += table[i - 1][j - A[L + i]];
      }
    }
  }
  return table[num - 1][S];
}
