#include <bits/stdc++.h>
using namespace std;
int a[3005];
int dp[3005][3005][5];
int n, s;
int main(void) {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  dp[0][0][1] = 1;
  for (int i = 1; i <= n; i++) {
    for (int x = 0; x <= s; x++) {
      dp[i][x][1] = dp[i - 1][x][1];
      if (x == a[i])
        dp[i][x][1] += i;
      else if (x > a[i])
        dp[i][x][1] += dp[i - 1][x - a[i]][1];
      dp[i][x][1] %= 998244353;
      dp[i][x][0] = dp[i - 1][x][0] + dp[i][x][1];
    }
  }
  cout << dp[n][s][0] << endl;
  return 0;
}
