#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
struct _ {
  ios_base::Init i;
  _() { cin.sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); }
} _;
int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
int main() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n + 1, 0);
  for (int i = 1; i <= n; i++) cin >> a[i];
  vector<vector<int>> dp(n + 1, vector<int>(s + 1, 0));
  dp[1][a[1]] = 1;
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  dp[1][0] = 2;
  for (int i = 2; i <= n; i++) {
    for (int j = a[i]; j <= s; j++) dp[i][j] = dp[i - 1][j - a[i]];
    for (int j = 0; j <= s; j++)
      dp[i][j] = (dp[i][j] % 998244353 + dp[i - 1][j] % 998244353) % 998244353;
  };
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans % 998244353 +
           (((dp[i][s] - dp[i - 1][s] + 998244353) % 998244353) *
            ((n - i + 1) % 998244353)) %
               998244353) %
          998244353;
  }
  cout << ans;
  return 0;
}
