#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s;
  cin >> n >> s;
  int arr[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  long long ans(0);
  vector<vector<pair<int, int> > > dp(s + 1);
  dp[0] = {{-1, -1}};
  for (int i = 0; i < n; ++i) {
    for (int j = s; j >= 0; --j) {
      if ((!dp[j].empty() || j == 0) && j + arr[i] <= s) {
        if (j == 0) {
          dp[arr[i]].push_back({i, i});
        } else {
          for (auto p : dp[j]) {
            dp[j + arr[i]].push_back({p.first, i});
          }
        }
      }
    }
  }
  for (auto p : dp[s]) {
    ans += (p.first + 1) * (n - p.second);
    ans %= 998244353;
  }
  cout << ans << '\n';
  return 0;
}
