#include <iostream> 
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <cctype>
#include <climits>

using namespace std;

using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;

using ll = long long int;

#define mp(a,b) make_pair(a,b)

const int MOD = 998244353;

bool res() {
	int n, s;
	cin >> n >> s;
	if (!cin) return false;

	vi v(n);
	for (int i = 0; i < n; ++i) cin >> v[i];

	ll res = 0;

	
	vector<ll> kn(s + 1, 0);
	kn[0] = 1;
	for (int j = n - 1; j >= 0; --j) {
		for (int d = s; d >= 0; --d) {
			if (kn[d] != 0 && d + v[j] <= s) {
				#include <iostream> 
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <cctype>
#include <climits>
 
using namespace std;
 
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
 
using ll = long long int;
 
#define mp(a,b) make_pair(a,b)
 
const int MOD = 998244353;
 
bool res() {
	int n, s;
	cin >> n >> s;
	if (!cin) return false;
 
	vi v(n);
	for (int i = 0; i < n; ++i) cin >> v[i];

 
	ll res = 0;
 
	
	vector<ll> kn(s + 1, 0);
	kn[0] = 1;
	for (int j = ini; j < n; ++j) {
		for (int d = s; d >= 0; --d) {
			if (kn[d] != 0 && d + v[j] <= s) {
				kn[d + v[j]] = (kn[d] + kn[d + v[j]]) % MOD;
					
				if (d + v[j] == s) {
					res = (res + (n - j)* j * kn[d]) % MOD;
				}
				
			}
		}
	}
 
	cout << res << '\n';
 
	return true;
}


int main() {
	while (res()) {}
	return 0;
}