#include <bits/stdc++.h>
using namespace std;
int a[3005];
long long dp[3005];
const long long mod = 998244353;
long long ad(long long a, long long b) { return ((a % mod) + (b % mod)) % mod; }
long long ap(long long a, long long b) { return ((a % mod) * (b % mod)) % mod; }
int main(int argc, char** argv) {
  int n, s;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (s == a[i]) ans = ad(ans, ap(i, n - i + 1));
    if (dp[s - a[i]]) ans = ad(ans, ap((dp[s - a[i]]), (n - i + 1)));
    for (int j = s; j >= 1; j--) {
      if (j + a[i] > s) continue;
      dp[j + a[i]] = ad(dp[j + a[i]], dp[j]);
    }
    dp[a[i]] = ad(dp[a[i]], i);
  }
  cout << ans;
  return 0;
}
