#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 5, MOD = 998244353;
long long n, s;
long long a[N], f[N];
long long ans;
signed main() {
  scanf("%lld%lld", &n, &s);
  for (long long i = 1; i <= n; ++i) scanf("%lld", a + i);
  f[a[1]] = 1;
  for (long long i = 2; i <= n; ++i) {
    (ans += f[s - a[i]] * (n - i + 1) % MOD) %= MOD;
    for (long long j = s; j > a[i]; --j) (f[j] += f[j - a[i]]) %= MOD;
    (f[a[i]] += i) %= MOD;
  }
  printf("%lld\n", ans);
  return 0;
}
