#!/usr/bin/python3
import sys
from functools import lru_cache
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().strip()
n, s = [int(x) for x in input().split()]
a = [0, *(int(x) for x in input().split())]
M = 998244353
@lru_cache
def count(i, s, hasL, hasR):
    global n, a
    if i == 0:
        return s == 0 and hasL
    else:
        return sum([
            count(i - 1, s, hasL, hasR),
            count(i - 1, s - a[i], False, True) * (n - i + 1) % M if not hasR and a[i] <= s else 0,
            count(i - 1, s - a[i], True, True) * (n - i + 1) % M * i % M if not hasR and a[i] <= s else 0,
            count(i - 1, s - a[i], True, True) * i % M if hasR and not hasL and a[i] <= s else 0,
            count(i - 1, s - a[i], False, True) if hasR and not hasL and a[i] <= s else 0            
        ]) % M

print(count(n, s, False, False))
