#include <bits/stdc++.h>
using namespace std;
const long long modu = 998244353;
long long dp[3001][3001];
long long a[3001];
long long calc(long long i, long long j) {
  if (i < 1) return 0;
  if (j < a[i]) return 0;
  if (dp[i][j] != -1) return dp[i][j];
  long long sum = 0;
  for (long long k = 1; k < i; k++) {
    sum += calc(k, j - a[i]);
  }
  dp[i][j] = sum;
  return sum;
}
signed main() {
  long long n, s;
  cin >> n >> s;
  for (long long i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i < n + 1; i++) {
    for (long long j = 1; j < s + 1; j++) {
      dp[i][j] = -1;
    }
  }
  for (long long i = 1; i < n + 1; i++) {
    dp[i][a[i]] = i;
  }
  long long sum = 0;
  for (long long i = 1; i < n + 1; i++) {
    sum += (n - i + 1) * (calc(i, s));
    sum %= modu;
  }
  cout << sum << endl;
}
