#include <bits/stdc++.h>
using namespace std;
inline void logger() { cout << " [LOGGER] " << endl; }
template <typename A, typename... B>
void logger(const A& a, const B&... b) {
  cout << a << " , ";
  logger(b...);
}
const long long MOD = 1000000007;
const long long MOD9 = 998244353;
const long long INF = MOD * MOD;
const int MAX = 200005;
long long dp[3005][3005], dp2[3005][3005];
int main() {
  long long n, s;
  cin >> n >> s;
  for (int(i) = 0; (i) < (n); (i)++) {
    dp[i][0] = (i + 1) * (i + 2) / 2 + 1 - (i + 2);
    dp2[i][0] = i + 2;
    dp[i][0] %= MOD9;
  }
  for (int(i) = 0; (i) < (n); (i)++) {
    long long a;
    cin >> a;
    if (i == 0) {
      dp[0][a] = 1;
      dp2[0][a] = 1;
    } else {
      for (int(w) = 1; (w) <= (s); (w)++) {
        dp[i][w] = dp[i - 1][w] + dp2[i - 1][w];
        dp2[i][w] = dp2[i - 1][w];
        if (w >= a) dp2[i][w] += dp2[i - 1][w - a];
        dp[i][w] %= MOD9;
        dp2[i][w] %= MOD9;
      }
    }
  }
  cout << (dp[n - 1][s] + dp2[n - 1][s]) << endl;
}
