var t,l,n,m,i:longint; x,ans,r:int64; begin readln(t); for l:=1 to t do begin ans:=0; readln(n,m); for i:=1 to n do begin read(r); ans:=ans+r; end; readln; for i:=1 to m do begin readln(x); if (x>ans) then write('1') else write('0'); end; writeln; end; end.