#include <bits/stdc++.h>
using namespace std;
const int MAX_S = 3000;
const int MAX_N = 3000;
using P = pair<int, int>;
set<pair<int, int>> dpS[MAX_S];
bool dp[MAX_N][MAX_S];
int main() {
  int64_t N, S;
  cin >> N >> S;
  vector<int64_t> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < N; i++) {
    int x = vec.at(i);
    if (i == 0) {
      dp[i][x] = true;
      P p = make_pair(i, i);
      dpS[x].insert(p);
    } else {
      for (int j = 0; j < S; j++) {
        if (dp[i - 1][j]) {
          dp[i][j] = true;
          if (j + x <= S) {
            dp[i][j + x] = true;
            for (auto itr = dpS[j].begin(); itr != dpS[j].end(); itr++) {
              P a = *itr;
              a = make_pair(a.first, i);
              dpS[j + x].insert(a);
            }
          }
        }
      }
      dp[0][x] = true;
      P p = make_pair(i, i);
      dpS[x].insert(p);
    }
  }
  for (auto itr = dpS[S].begin(); itr != dpS[S].end(); itr++) {
    P p = *itr;
  }
  int64_t ans = 0;
  int64_t MOD = 998244353;
  for (auto itr = dpS[S].begin(); itr != dpS[S].end(); itr++) {
    P p = *itr;
    int64_t a = p.first;
    int64_t b = N - p.second + 1;
    ans += a * b;
    if (a == b) {
      ans++;
    }
    ans %= MOD;
  }
  cout << ans << endl;
}
