#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 998244353;
const int INF32 = 1e9 + 1e2;
template <typename T>
istream &operator>>(istream &a, vector<T> &v) {
  for (auto &first : v) a >> first;
  return a;
}
void stndrtn() {}
const int N = 3e3 + 10;
ll dp[N];
void add(ll &first, ll second) {
  first += second;
  if (first >= MOD) first -= MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr), stndrtn();
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  cin >> a;
  ll ans = 0;
  for (int i = 1; i <= n; ++i) {
    int first = a[i - 1];
    if (s >= first)
      add(ans, (n - i + 1) * 1ll * (s > first ? dp[s - first] : i));
    for (int j = s - 1; ~j; --j) {
      if (j + first > s) continue;
      add(dp[j + first], dp[j]);
    }
    if (first < s) add(dp[first], i);
  }
  cout << ans;
  return 0;
}
