#include <bits/stdc++.h>
using namespace std;
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 = 0; L < N; L++) {
    int table[N][S + 1];
    for (int i = 0; i < N; i++) {
      for (int j = 0; j <= S; j++) {
        table[i][j] = 0;
      }
      table[i][0] = 1;
    }
    table[L][A[L]] = 1;
    for (int R = L + 1; R < N; R++) {
      for (int j = 0; j <= S; j++) {
        table[R][j] = table[R - 1][j];
        if (j >= A[R]) {
          table[R][j] += table[R - 1][j - A[R]];
        }
      }
    }
    for (int i = L; i < N; i++) {
      retval += table[i][S];
    }
  }
  cout << retval % 998244353 << endl;
  return 0;
}
