#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, s;
  std::cin >> n >> s;
  vector<long long> a(n);
  const long long MOD = 998244353;
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  vector<vector<long long>> dp(n + 1, vector<long long>(s + 1, 0));
  dp[0][0] = 1;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= s; j++) {
      dp[i + 1][j] = dp[i][j];
    }
    for (int j = a[i]; j <= s; j++) {
      dp[i + 1][j] += dp[i][j - a[i]];
      dp[i + 1][j] %= MOD;
    }
    dp[i + 1][a[i]] += i;
  }
  for (int i = 1; i <= n; i++) {
    ans += dp[i][s];
    ans %= MOD;
  }
  std::cout << ans << std::endl;
}
