#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007, MOD2 = 998244353;
int main() {
  int N, S;
  cin >> N >> S;
  vector<int> A(N);
  for (int i = 0; i < (N); i++) {
    cin >> A.at(i);
  }
  vector<vector<vector<int>>> dp(N, vector<vector<int>>(N, vector<int>(S + 1)));
  ll ans = 0;
  for (int i = 0; i < (N); i++) {
    int sma = 0;
    if (A.at(i) > S) {
      continue;
    }
    if (A.at(i) == S) {
      sma = (i + 1) * (N - i);
    } else {
      dp.at(i).at(i).at(A.at(i)) = 1;
      for (int j = i; j < N - 1; j++) {
        for (int k = A.at(i); k < S; k++) {
          dp.at(i).at(j + 1).at(k) += dp.at(i).at(j).at(k);
          dp.at(i).at(j + 1).at(k) %= MOD2;
          if (k + A.at(j + 1) <= S) {
            dp.at(i).at(j + 1).at(k + A.at(j + 1)) += dp.at(i).at(j).at(k);
            dp.at(i).at(j + 1).at(k + A.at(j + 1)) %= MOD2;
          }
        }
      }
      for (int j = i; j < N; j++) {
        int x = dp.at(i).at(j).at(S);
        x *= (i + 1) * (N - j);
        x %= MOD2;
        sma += x;
        sma %= MOD2;
      }
    }
    ans += sma;
    ans %= MOD2;
  }
  cout << ans << endl;
}
