import sys

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, 0, 0) for _ in range(S + 1)]
    dp[0] = (1, 0, 0)

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

    print(dp[S][2])


if __name__ == "__main__":
    main()
