#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#pragma GCC target("avx,tune=native")
using namespace std;
long long inv(long long a, long long b) {
  return (a > 1 ? b - inv(b % a, a) * b / a : 1);
}
const long double e = 2.71828182845904523536028747;
const long double PI = 3.14159265359;
const long long inf = (1LL << 62);
const int iinf = (1 << 30);
int n, a[3010], s;
vector<int> dp[3010];
int ans = 0;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = s; j >= a[i]; j--) {
      if (j == a[i]) {
        dp[j].emplace_back(i);
      } else {
        for (int it : dp[j - a[i]]) dp[j].emplace_back(it);
      }
      if (j == s) {
        for (auto &it : dp[s]) {
          ans = (ans + it * (n - i + 1)) % 998244353;
        }
        dp[s].clear();
      }
    }
  }
  cout << ans;
  return 0;
}
