#include <bits/stdc++.h>
using namespace std;
const pair<long long, long long> dxy[] = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};
const long long mod = 998244353;
const long long inf = 2e18;
const long double eps = 1e-9;
const long long NN = 1e5 + 2;
const long long S = 1001;
long long dp[S][S][3];
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
void solve() {
  long long i = 0, j = 0, k = 0, n = 0, s = 0;
  cin >> n >> s;
  vector<long long> a(n);
  for (i = 0; i < (n); i++) {
    cin >> a[i];
  };
  for (k = 0; k < (3); k++) dp[0][a[0]][k] = 1;
  ;
  for (i = 1; i < n; i++) {
    for (j = 0; j < (s + 1); j++) {
      for (k = 0; k < (3); k++) {
        dp[i][j][k] = dp[i - 1][j][k];
        if (k == 2) dp[i][j][k] = (dp[i][j][k] + dp[i - 1][j][1]) % mod;
      }
    }
    for (j = 0; j <= s - a[i]; j++) {
      dp[i][j + a[i]][0] += dp[i - 1][j][0];
      dp[i][j + a[i]][0] %= mod;
      dp[i][j + a[i]][1] += dp[i - 1][j][1];
      dp[i][j + a[i]][1] %= mod;
      dp[i][j + a[i]][2] += dp[i - 1][j][1];
      dp[i][j + a[i]][2] %= mod;
    }
    dp[i][a[i]][0]++;
    dp[i][a[i]][1] += i + 1;
    dp[i][a[i]][2] += i + 1;
    ;
  }
  cout << (dp[n - 1][s][2] % mod) << '\n';
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long T = 1;
  for (long long tc = 1; tc <= T; tc++) {
    solve();
  }
  return 0;
}
