#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
long long nxt() {
  long long x;
  cin >> x;
  return x;
}
const int N = 3e3 + 5;
const int mod = 998244353;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, s;
  cin >> n >> s;
  long long ans = 0;
  vector<vector<int>> dp(n + 1, vector<int>(s + 1));
  for (int i = 1; i <= int(n); ++i) {
    int x;
    cin >> x;
    dp[i][x] = i;
    for (int j = 0; j <= s; j++) {
      dp[i][j] = dp[i - 1][j];
      if (j - x >= 0) (dp[i][j] += dp[i - 1][j - x]) %= mod;
    }
  }
  for (int i = 1; i <= int(n); ++i) ans = (ans + dp[i][s]) % mod;
  cout << ans;
  return 0;
}
