import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as VU
import Data.Bool (bool)

main :: IO ()
main = do
  let
    modulus = 998244353 :: Int
  [_, s] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    f :: [Int] -> Int
    f = VU.last . snd . foldl step (1, VU.replicate (succ s) 0)
      where
        step :: (Int, VU.Vector Int) -> Int -> (Int, VU.Vector Int)
        step (d, v) x = (2 * d `mod` modulus, VU.generate (succ s) g)
          where
            g :: Int -> Int
            g i = (2 * (v VU.! i) + bool 0 d (i == x) + bool 0 (v VU.! (i - x)) (x < i)) `mod` modulus
  as <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  print . f $ as

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}
