#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 998244353;
const int seed = 233;
const double PI = acos(-1.0);
const double eps = 1e-7;
const int inf = 0x3f3f3f3f;
const int max_n = 3005;
long long ceil(long long x, long long y) {
  if (x == 0) return 0;
  if (y < 0) x = -x, y = -y;
  bool sign = x > 0;
  x = abs(x);
  return sign ? (x + y - 1) / y : -x / y;
}
long long floor(long long x, long long y) {
  if (x == 0) return 0;
  if (y < 0) x = -x, y = -y;
  bool sign = x > 0;
  x = abs(x);
  return sign ? x / y : -(x + y - 1) / y;
}
namespace {
inline int Add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
inline int Sub(int x, int y) { return (x -= y) < 0 ? x + mod : x; }
inline int Mul(int x, int y) { return 1ll * x * y % mod; }
inline int Pow(int x, int y = mod - 2) {
  if (y == 0) return 1;
  int res = 1;
  while (y) {
    if (y & 1) res = 1ll * res * x % mod;
    x = 1ll * x * x % mod;
    y >>= 1;
  }
  return res;
}
}  // namespace
int n, s;
int dp[max_n];
int main() {
  scanf("%d%d", &n, &s);
  int ans = 0;
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    if (s >= x) ans = Add(ans, Mul(dp[s - x], n - i + 1));
    for (int j = s; j >= x + 1; j--) dp[j] = Add(dp[j], dp[j - x]);
    dp[x] = Add(dp[x], i);
  }
  printf("%d\n", ans);
  return 0;
}
