Problem:
Score : 600 points

Problem Statement

Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S.

For a non-empty subset T of the set \{1, 2, \ldots , N \}, let us define f(T) as follows:

f(T) is the number of different non-empty subsets \{x_1, x_2, \ldots , x_k \} of T such that A_{x_1}+A_{x_2}+\cdots +A_{x_k} = S.

Find the sum of f(T) over all 2^N-1 subsets T of \{1, 2, \ldots , N \}. Since the sum can be enormous, print it modulo 998244353.

Constraints

All values in input are integers.

1 \leq N \leq 3000

1 \leq S \leq 3000

1 \leq A_i \leq 3000

Input

Input is given from Standard Input in the following format:

N S
A_1 A_2 ... A_N

Output

Print the sum of f(T) modulo 998244353.

Sample Input 1

3 4
2 2 4

Sample Output 1

6

For each T, the value of f(T) is shown below. The sum of these values is 6.

f(\{1\}) = 0

f(\{2\}) = 0

f(\{3\}) = 1 (One subset \{3\} satisfies the condition.)

f(\{1, 2\}) = 1 (\{1, 2\})

f(\{2, 3\}) = 1 (\{3\})

f(\{1, 3\}) = 1 (\{3\})

f(\{1, 2, 3\}) = 2 (\{1, 2\}, \{3\})

Sample Input 2

5 8
9 9 9 9 9

Sample Output 2

0

Sample Input 3

10 10
3 1 4 1 5 9 2 6 5 3

Sample Output 3

3296

Solution in C# (.NET Core 3.1.201) (judge verdict: Wrong Answer)

using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (N, S) = Slice2<long>();
            // Sより大きいものはけしておく。大きい方から考えた方が枝きりしやすい
            var Ai = Sarray().Where(a => a <= S).OrderByDescending(a => a).ToArray();
            N = Ai.Length;
            var ans = 0L;
            var dct = new Dictionary<(long sum,long num),long>();//累計,要素数,数
            var rem = Ai.Sum();
            var pow2 = Enumerable.Range(0, 3001).Select(i => ModPow(2, i, Mod)).ToArray();
            dct[(0, 0)] = 1;
            for (var i = 0; i < N; ++i)//Ai[i]まで使ったとき
            {
                rem -= Ai[i];
                var td = new Dictionary<(long sum, long num), long>();
                foreach (var d in dct)
                {
                    // Ai[i]を使わない場合
                    var k1 = d.Key;
                    if (!td.ContainsKey(k1)) td[k1] = 0;
                    td[k1] += d.Value;
                    // Ai[i]を使う場合
                    var k2 = (d.Key.sum + Ai[i], d.Key.num + 1);
                    // Sよりでかくなる or 残り全部足してもS未満なら打ち切り
                    if (S < k2.Item1) continue;
                    if (k2.Item1 + rem < S) continue;
                    if (!td.ContainsKey(k2)) td[k2] = 0;
                    td[k2] += d.Value;
                }
                dct = new Dictionary<(long sum, long num), long>();
                foreach (var d in td)
                {
                    if (d.Key.sum == S) { ans = (ans + pow2[N - d.Key.num] * d.Value % Mod) % Mod; }
                    else dct[d.Key] = d.Value;
                }
            }
            WriteLine(ans);

        }
        static long ModPow(long a, long n, long mod)
        {
            var res = 1L;
            while (0 < n)
            {
                if (n % 2 != 0) res = res * a % mod;
                a = a * a % mod;
                n >>= 1;
            }
            return res;
        }
        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}