#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 5;
const int mod = 998244353;
ll dp[3005][3005];
inline int power(int x, int y, int res = 1) {
  for (; y; y >>= 1, x = 1ll * x * x % mod) {
    if (y & 1) {
      res = 1ll * res * x % mod;
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, s;
  cin >> n >> s;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    dp[i + 1][a[i]] = i + 1;
    for (int j = 0; j <= s; j++) {
      dp[i + 1][j] += dp[i][j];
      if (j + a[i] <= s) {
        dp[i + 1][j + a[i]] += dp[i][j];
        dp[i + 1][j + a[i]] %= mod;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    4;
    dp[i][s] += dp[i - 1][s];
  }
  cout << dp[n][s];
}
