#include #include #include #include #include #include #include #include #include #include #include #pragma comment(linker, "/STACK:102400000,102400000") using namespace std; typedef long long LL; typedef unsigned long long ULL; const int MN = 100 + 10; const int ME = 1000000 + 10; const LL mod = 998244353LL; const double pi = acos(-1.0); const int Intmax = (~(1 << 31)); const int Intmin = (1 << 31); const LL LLmax = (~(1LL << 63)); const LL LLmin = (1LL << 63); const ULL ULLmax = (~(0ULL)); int main() { #ifndef ONLINE_JUDGE freopen("1.cpp", "r", stdin); #endif // ONLINE_JUDGE int t; scanf("%d",&t); while(t--){ int n,m; scanf("%d%d",&n,&m); LL ans=0; while(n--){ int x; scanf("%d",&x); ans+=x; } while(m--){ LL q; scanf("%I64d",&q); int p=q>ans?1:0; printf("%d",p); } printf("\n"); } return 0; }