package no332; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long x = sc.nextLong(); ArrayList a = new ArrayList<>(); //i,a for(int i=0;iInteger.compare(xx.a, yy.a)); int ones = 0; for(Pair p:a) { if (p.a == 1) { ones++; }else{ break; } } int n2 = n - ones; int n3 = n2 / 2; int n4 = n2 - n3; ArrayList al = new ArrayList<>(); for(int i=0;i<1<>j&1)==1) { sum += a.get(ones + j).a; } } al.add(new Pair2(i, sum)); } Collections.sort(al,(xx,yy)->Long.compare(xx.sum, yy.sum)); for(int i=0;i<1<>j&1)==1) { sum += a.get(ones + n3 + j).a; } } if (sum > x) { continue; } long key = x - sum; int l = 0; int r = al.size(); while(l + 1 < r) { int c = (l + r) >>> 1; if (al.get(c).sum <= key) { l = c; }else{ r = c; } } if (sum + al.get(l).sum + ones >= x) { boolean[] ans = new boolean[n]; for(int j=0;j> j & 1) == 1) { ans[a.get(ones + j).i] = true; } } for(int j=0;j>j&1)==1) { ans[a.get(ones + n3 + j).i] = true; } } for(int j=0;j