#include <bits/stdc++.h>
using namespace std;
string to_string(const string& s) { return '"' + s + '"'; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << " " << to_string(H);
  debug_out(T...);
}
using ld = long double;
using vi = vector<int>;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using vl = vector<ll>;
using vul = vector<ull>;
const int N = 3e3 + 5, S = N;
const int MOD = 998244353;
int n, s;
int dp[N][S][3];
void solve() {
  cin >> n >> s;
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    int a;
    cin >> a;
    int pi = i - 1;
    for (int j = 0; j <= s; ++j) {
      (dp[i][j][0] += dp[pi][j][0]) %= MOD;
      (dp[i][j][1] += dp[pi][j][0] + dp[pi][j][1]) %= MOD;
      (dp[i][j][2] += dp[pi][j][0] + dp[pi][j][1] + dp[pi][j][2]) %= MOD;
      if (j + a > s) continue;
      (dp[i][j + a][1] += dp[pi][j][0] + dp[pi][j][1]) %= MOD;
      (dp[i][j + a][2] += dp[pi][j][0] + dp[pi][j][1]) %= MOD;
    }
  }
  cout << dp[n][s][2] << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  ;
  int t = 1;
  for (int i = 1; i <= t; ++i) {
    solve();
  }
}
