#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll dp[3000][3000];
vector<int> a;
const ll M = 998244353;
ll ans = 0;
int main() {
  int n, s;
  scanf("%d%d", &n, &s);
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    a.push_back(t);
  }
  for (int i = 0; i <= s; i++) {
    dp[i][0] = 1;
  }
  for (int len = 1; len <= n; len++) {
    for (int i = 0; i <= n - len; i++) {
      int j = i + len - 1;
      for (int v = s; v > 0; v--) {
        dp[i][v] = dp[i][v];
        if (v >= a[j]) dp[i][v] += dp[i][v - a[j]];
        dp[i][v] %= M;
      }
      ans += dp[i][s];
      ans %= M;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
