#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<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);
          if (arr[i] == s) {
            ans += (i + 1) * (n - i);
            ans %= 998244353;
          }
        } else {
          for (auto p : dp[j]) {
            dp[j + arr[i]].push_back(p);
            if (j + arr[i] == s) {
              ans += (p + 1) * (n - i);
              ans %= 998244353;
            }
          }
        }
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
