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