class FastModuloTransform():
    def __init__(self, omega, n, mod):
        self.n = n
        self.omega = omega
        self.mod = mod
        self.rev = pow(omega, mod - 2, mod)

    def _bit_reverse_(self, d):
        n = len(d)
        ns = n >> 1
        nss = ns >> 1
        ns1 = ns + 1
        i = 0
        for j in range(0, ns, 2):
            if j < i:
                d[i], d[j] = d[j], d[i]
                d[i + ns1], d[j + ns1] = d[j + ns1], d[i + ns1]
            d[i + 1], d[j + ns] = d[j + ns], d[i + 1]
            k = nss
            i ^= k
            while k > i:
                k >>= 1
                i ^= k
        return d

    def _fmt_(self, A, base):
        halfpow = pow(base, self.n // 2, self.mod)
        n = self.n
        m = 1
        while n > 1:
            n >>= 1
            w = pow(base, n, self.mod)
            wk = 1
            for j in range(m):
                for i in range(j, self.n, 2 * m):
                    U = A[i]
                    V = (A[i + m] * wk) % self.mod
                    A[i] = (U + V) % self.mod
                    A[i + m] = (U + V * halfpow) % self.mod
                wk = (wk * w) % self.mod
            m <<= 1
        return A

    def fmt(self, f):
        A = f + [0] * (self.n - len(f))
        self._bit_reverse_(A)
        F = self._fmt_(A, self.omega)
        return F

    def ifmt(self, F):
        A = F + [0] * (self.n - len(F))
        self._bit_reverse_(A)
        nrev = pow(self.n, self.mod - 2, self.mod)
        f = [(e * nrev) % self.mod for e in self._fmt_(A, self.rev)]
        return f

    def convolute(self, f, g):
        F = self.fmt(f)
        G = self.fmt(g)
        H = [(s * t) % self.mod for s, t in zip(F, G)]
        h = self.ifmt(H)
        return h

fmt = FastModuloTransform(299814, 2**12, 998244353)

MOD = 998244353

N, S = map(int, input().split())
A = list(map(int, input().split()))

F = [0]
res = 0

for i in range(N):
    F[0] += 1
    f = [0 for _ in range(A[i] + 1)]
    f[0] = 1
    f[-1] = 1
    F = fmt.convolute(F, f)
    F = F[:S + 1]
    res += F[S]
    res %= MOD

print(res)