#include <bits/stdc++.h>
using namespace std;
int n, s, a[3005];
long long dp[3005][3005];
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  long long ans = 0;
  for (int st = 1; st <= n; st++) {
    for (int i = st; i <= n; i++) {
      if (i == st)
        for (int j = 0; j <= s; j++) dp[i][j] = (j == a[i] || j == 0) ? 1 : 0;
      else
        for (int j = 0; j <= s; j++) {
          if (j >= a[i])
            dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - a[i]]) % 998244353;
          else
            dp[i][j] = dp[i - 1][j] % 998244353;
        }
    }
    for (int i = st; i <= n; i++) ans = (dp[i][s] + ans) % 998244353;
  }
  printf("%d\n", ans);
  return 0;
}
