using System.Collections.Generic; using System.Linq; using static System.Math; using System; public class P { public long sum { get; set; } public string x { get; set; } } public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var w = long.Parse(line[1]); line = Console.ReadLine().Trim().Split(' '); var a = Array.ConvertAll(line, long.Parse); getAns(n, w, a); } static string change(string t) { var res = ""; foreach (var x in t) { if (x == '2') res += "1"; else res += x; } return res; } static long w0(int n, long[] a) { var c = a.Count(x => x == 0); return (long)Pow(2, c) - 1L; } static void getAns(int n, long w, long[] a) { if (w == 0) { Console.WriteLine(w0(n, a)); return; } var hs = new HashSet(); var q = new Queue

(); q.Enqueue(new P { x = "2", sum = a[0] }); q.Enqueue(new P { x = "1", sum = a[0] / 2L }); q.Enqueue(new P { x = "0", sum = 0 }); while (q.Count() > 0) { var t = q.Dequeue(); var tn = t.x.Length; if (tn == n) { if (t.sum == w) hs.Add(change(t.x)); continue; } if (t.sum + a[tn] <= w) q.Enqueue(new P { x = t.x + "2", sum = t.sum + a[tn] }); if (t.sum + a[tn] / 2L <= w) q.Enqueue(new P { x = t.x + "1", sum = t.sum + a[tn] / 2L }); q.Enqueue(new P { x = t.x + "0", sum = t.sum }); } Console.WriteLine(hs.Count()); } }