#include <bits/stdc++.h>
using namespace std;
int n, tot, ans, s;
int a[3010], f[3010];
int main() {
  int t;
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = s; j > a[i]; j--) {
      f[j] = (f[j] + f[j - a[i]]) % 998244353;
    }
    f[a[i]] = (f[a[i]] + i) % 998244353;
    ans = (ans + (n - i + 1) * f[s] % 998244353) % 998244353;
    f[s] = 0;
  }
  cout << (long long)ans << endl;
  return 0;
}
