#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1000000007;
ll mod = 998244353;
int inf = 1000001000;
ll INF = 1e18 + 5;
int main() {
  ll n, s, ans = 0;
  cin >> n >> s;
  vector<ll> a(n, 0);
  for (int(i) = 0; (i) < (n); (i)++) cin >> a[i];
  vector<vector<ll>> dp(n + 1, vector<ll>(3001, 0));
  for (int(i) = 0; (i) < (n); (i)++)
    for (int(j) = 0; (j) < (3001); (j)++) {
      dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % mod;
      if (j == 0)
        dp[i + 1][a[i]] = i + 1;
      else {
        if (j + a[i] <= 3000)
          dp[i + 1][j + a[i]] = (dp[i + 1][j + a[i]] + dp[i][j]) % mod;
        if (j + a[i] == s) ans = (ans + dp[i + 1][j + a[i]] * (n - i)) % mod;
      }
    }
  cout << ans << endl;
}
