#include <bits/stdc++.h>
using namespace std;
int N, S;
int A[3003], cnt[3003][3003];
int main() {
  cin >> N >> S;
  for (int i = 1; i <= N; ++i) {
    cin >> A[i];
  }
  int total = 0;
  for (int i = 1; i <= N; ++i) {
    cnt[i - 1][0] = i;
    for (int j = 1; j < A[i]; ++j) cnt[i][j] = cnt[i - 1][j];
    for (int j = A[i]; j <= S; ++j) {
      cnt[i][j] = cnt[i - 1][j] + cnt[i - 1][j - A[i]];
    }
    total += cnt[i][S];
    total %= 998244353;
  }
  cout << total;
  return 0;
}
