#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (true) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    long long p = b % a, q = a;
    a = p;
    b = q;
  }
}
long long powerMod(long long x, long long y) {
  long long res = 1;
  x %= 998244353;
  while (y > 0) {
    if (y & 1) res = (res * x) % 998244353;
    y = y >> 1;
    x = (x * x) % 998244353;
  }
  return res % 998244353;
}
string binary(long long s) {
  string res = "";
  while (s != 0) {
    res += (char)('0' + s % 2);
    s /= 2;
  }
  reverse(res.begin(), res.end());
  return res;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, s, i, j, k, l, p;
  cin >> n >> s;
  vector<long long> a(n);
  vector<vector<long long> > dp(n + 1, vector<long long>(s + 1, 0LL));
  for (auto &i : a) cin >> i;
  for (i = p = 0LL; i < n; i++) {
    dp[i + 1] = dp[i];
    (dp[i + 1][a[i]] += i + 1LL) %= 998244353;
    for (j = 0LL; j <= s - a[i]; j++) {
      (dp[i + 1][j + a[i]] += dp[i][j]) %= 998244353;
    }
    (p += dp[i + 1][s]) %= 998244353;
  }
  cout << p << "\n";
  return 0;
}
