#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define getmid(l,r) ((l) + ((r) - (l)) / 2) #define MEM(a,b) memset(a,b,sizeof(a)) #define MP(a,b) make_pair(a,b) #define PB push_back typedef long long ll; typedef pair pii; const double eps = 1e-8; const int INF = (1 << 30) - 1; const int maxn = 200010; const int mod = 998244353; int T,n,m; int main(){ scanf("%d",&T); while(T--){ scanf("%d%d",&n,&m); ll sum = 0; for(int i = 1; i <= n; ++i){ int a; scanf("%d",&a); sum += a; } for(int i = 1; i <= m; ++i){ ll q; scanf("%I64d",&q); if(q > sum) printf("1"); else printf("0"); } puts(""); } return 0; }