#include <bits/stdc++.h>
using namespace std;
long long n, s;
vector<long long> a;
const long long M = 998244353;
long long dp[3002][3002];
int main() {
  cin >> n >> s;
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long result = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] < s) {
      if (i != 0) result = (result + dp[i - 1][s - a[i]] * (n - i)) % M;
    } else if (a[i] == s) {
      result = (result + (i + 1) * (n - i)) % M;
    }
    for (int j = 0; j <= n; j++) {
      if (i == 0) {
        dp[i][j] = (a[i] == j) ? 1 : 0;
      } else {
        if (j > a[i]) {
          dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - a[i]]) % M;
        } else if (j == a[i]) {
          dp[i][j] = (dp[i - 1][j] + (i + 1)) % M;
        } else {
          dp[i][j] = dp[i - 1][j];
        }
      }
    }
  }
  cout << result << endl;
  return 0;
}
