#include <bits/stdc++.h>
using namespace std;
long long int pow1(long long int a, long long int b,
                   long long int m = 998244353) {
  if (b == 0)
    return 1ll;
  else if (b == 1)
    return a;
  else {
    long long int x = pow1(a, b / 2, m);
    x *= x;
    x %= m;
    if (b % 2) {
      x *= a;
      x %= m;
    }
    return x;
  }
}
template <class avgType>
avgType avg(avgType a, avgType b) {
  return (a + b) / 2;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
int randInt() { return rng() % INT_MAX; }
long long int randLL() { return rng64() % LLONG_MAX; }
vector<int> hashmods = {1000000007, 1000000009, 1000000021,
                        1000000033, 1000000087, 1000000093};
long long int n, s, a[3100], dp[2][3100];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long int ans = 0;
  for (int i = 1; i <= n; i++) {
    dp[1][a[i]] += i;
    for (int j = 0; j <= s - a[i]; j++) {
      dp[1][j + a[i]] += dp[0][j];
    }
    for (int j = 0; j <= s; j++) {
      dp[0][j] += dp[1][j];
      if (j == s) {
        ans += (dp[1][j] * (n - i + 1));
        ans %= 998244353;
      }
      dp[1][j] = 0;
    }
  }
  cout << ans << "\n";
  return 0;
}
