#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  bool first = true;
  for (const auto& j : v) {
    if (!first) {
      os << " ";
    }
    first = false;
    os << j;
  }
  os << "\n";
  return os;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& elem : v) {
    is >> elem;
  }
  return is;
}
vector<long long> f;
void set_f(int n) {
  f.resize(n + 1);
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    f[i] = (f[i - 1] * i) % 998244353;
  }
}
long long nod(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return nod(b, a % b);
  }
}
long long pw(long long x, long long n, long long m = 998244353) {
  if (n == 0) {
    return 1;
  }
  if (n % 2 == 0) {
    return pw((x * x) % m, n / 2, m);
  }
  return (pw(x, n - 1, m) * x) % m;
}
long long dv(long long a, long long b) {
  return (a * pw(b, 998244353 - 2)) % 998244353;
}
long long c_n_k(int n, int k) {
  if (k > n) {
    return 0;
  }
  if (k < 0) {
    return 0;
  }
  return dv(dv(f[n], f[k]), f[n - k]);
}
void solve() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  cin >> a;
  vector<long long> dp1(s + 1, 0);
  dp1[0] = 1;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] <= s) {
      ans = (ans + dp1[s - a[i]] * (n - i)) % 998244353;
    }
    vector<long long> dp2 = dp1;
    for (int j = a[i]; j <= s; j++) {
      if (j == a[i]) {
        dp2[j] += i + 1;
      } else {
        dp2[j] += dp1[j - a[i]];
      }
      dp2[j] %= 998244353;
    }
    dp1 = dp2;
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  if (0) {
    int tests;
    cin >> tests;
    for (int t = 1; t <= tests; t++) {
      solve();
    }
  } else {
    solve();
    cout << endl;
  }
  return 0;
}
