n, s = map(int, input().split())
a = list(map(int, input().split()))
dp = [[[]] * n for i in range(n)]
mod = 998244353
ans = 0
for d in range(n):
  for i in range(n-d):
    if d == 0:
      dp[i][i+d].append(a[i])
    elif d == 1:
      dp[i][i+d] = dp[i][i] + dp[i+1][i+1]
      dp[i][i+d].append(a[i]+a[i+1])
    else:
      dp[i][i+d] = dp[i][i+d-1] + dp[i+1][i+d]
      dp[i][i+d].append(a[i]+a[i+d])
      for j in range(len(dp[i+1][i+d-1])):
        dp[i][i+d].remove(dp[i+1][i+d-1][j])
        dp[i][i+d].append(a[i]+a[i+d]+dp[i+1][i+d-1][j])
    ans += dp[i][i+d].count(s)
    ans %= mod
print(ans)