#include <bits/stdc++.h>
using namespace std;
const int modu = 998244353;
int dp[3001][3001];
int a[3001];
int calc(int i, int j) {
  if (i < 1) return 0;
  if (j < a[i]) return 0;
  if (dp[i][j] != -1) return dp[i][j];
  int sum = 0;
  for (int k = 1; k < i; k++) {
    sum = (sum + calc(k, j - a[i])) % modu;
  }
  dp[i][j] = sum;
  return sum;
}
signed main() {
  int n, s;
  cin >> n >> s;
  for (int i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  for (int i = 1; i < n + 1; i++) {
    for (int j = 1; j < s + 1; j++) {
      dp[i][j] = -1;
    }
  }
  for (int i = 1; i < n + 1; i++) {
    dp[i][a[i]] = i;
  }
  int sum = 0;
  for (int i = 1; i < n + 1; i++) {
    sum = (sum + (n - i + 1) * (calc(i, s)) % modu);
  }
  cout << sum << endl;
}
