#include <bits/stdc++.h>
using namespace std;
const int maxn = 3001;
const long long mod = 998244353;
int a[maxn];
int n, s;
void enter() {
  cin >> n >> s;
  for (int i = (1), _b = (n + 1); i < _b; ++i) cin >> a[i];
}
long long f[maxn][maxn];
void qhd() {
  long long ans = 0;
  for (int i = (1), _b = (n + 1); i < _b; ++i) {
    for (int j = (0), _b = (s + 1); j < _b; ++j) {
      if (j == a[i])
        f[i][j] += long long(i);
      else if (j > a[i])
        f[i][j] += f[i - 1][j - a[i]];
      f[i][j] += f[i - 1][j];
      f[i][j] = f[i][j] % mod;
    }
    ans += (f[i][s] % mod);
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  enter();
  qhd();
}
