import bisect
import copy
import heapq
import sys
import itertools
import queue

input = sys.stdin.readline
sys.setrecursionlimit(100000)
# mod = 10 ** 9 + 7
mod = 998244353


def read_values():
    return map(int, input().split())


def read_index():
    return map(lambda x: int(x) - 1, input().split())


def read_list():
    return list(read_values())


def read_lists(N):
    return [read_list() for n in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v

    def __str__(self):
        return str(self.v)

    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n)


def main():
    N, S = read_values()
    A = read_list()

    dp = [[[0 for _ in range(3)] for _ in range(S + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1

    for i, a in enumerate(A):
        for s in range(S + 1):
            dp[i + 1][s][0] += dp[i][s][0]
            dp[i + 1][s][1] += (dp[i][s][1] + dp[i][s][0]) % mod + (
                0 if s - a < 0 else dp[i][s - a][0] + dp[i][s - a][1]
            ) % mod
            dp[i + 1][s][2] += (
                sum(dp[i][s]) % mod
                + (0 if s - a < 0 else dp[i][s - a][1] + dp[i][s - a][0]) % mod
            )

            dp[i + 1][s][0] %= mod
            dp[i + 1][s][1] %= mod
            dp[i + 1][s][2] %= mod

    print(dp[N][S][2])


if __name__ == "__main__":
    main()
