#include <bits/stdc++.h>
using namespace std;
long long inv(long long a, long long b) {
  return (a > 1 ? b - inv(b % a, a) * b / a : 1);
}
const int MOD = 998244353;
const int N = 3010;
const long double e = 2.71828182845904523536028747;
const long double PI = 3.14159265359;
const long long inf = (1LL << 62);
const int iinf = (1 << 30);
int n, s, dp[N][N];
long long ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ifstream cin("test.in");
  cin >> n >> s;
  for (int i = 1, x; i <= n; i++) {
    cin >> x;
    for (int j = 1; j <= s; j++) dp[i][j] = dp[i - 1][j];
    if (x == s) ans = (ans + i * (n - i + 1)) % MOD;
    for (int j = s; j >= x; j--) {
      if (j == s)
        ans = (ans + 1LL * (n - i + 1) * dp[i - 1][j - x]) % MOD;
      else if (j == x)
        dp[i][j] = (dp[i][j] + i) % MOD;
      else
        dp[i][j] = (dp[i][j] + dp[i - 1][j - x]) % MOD;
    }
  }
  cout << ans;
  return 0;
}
