#include <bits/stdc++.h>
using namespace std;
int dfs(vector<vector<int>> &dp, vector<vector<int>> &dp2, const vector<int> &v,
        const int &n, int i, int s);
int dfs2(vector<vector<int>> &dp, vector<vector<int>> &dp2,
         const vector<int> &v, const int &n, int i, int t) {
  if (dp2[i][t] != -1) return dp2[i][t];
  if (i == 0) return dp2[i][t] = dfs(dp, dp2, v, n, i, t);
  return dp2[i][t] = dfs(dp, dp2, v, n, i, t) + dfs2(dp, dp2, v, n, i - 1, t);
}
int dfs(vector<vector<int>> &dp, vector<vector<int>> &dp2, const vector<int> &v,
        const int &n, int i, int s) {
  if (dp[i][s] != -1) return dp[i][s];
  if (v[i] > s) return dp[i][s] = 0;
  if (v[i] == s) return dp[i][s] = i + 1;
  int t = s - v[i];
  if (i == 0) return dp[i][s] = 0;
  return dp[i][s] = dfs2(dp, dp2, v, n, i - 1, t);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, sum;
  cin >> n >> sum;
  vector<int> v(n, 0);
  for (int i = 0; i < n; i++) cin >> v[i];
  const int M = 998244353;
  vector<vector<int>> dp(n, vector<int>(sum + 1, -1));
  vector<vector<int>> dp2(n, vector<int>(sum + 1, -1));
  long res = 0;
  for (int i = 0; i < n; i++) {
    res = (res + (long)dfs(dp, dp2, v, n, i, sum) * (long)(n - i) % M) % M;
  }
  cout << res << endl;
  return 0;
}
