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