#include using namespace std; #define LL long long int T, n, m; const int maxn = 1e5; int a[maxn]; int main() { scanf("%d", &T); while(T--) { scanf("%d%d", &n, &m); LL sum = 0; for(int i = 0; i < n; ++i) { scanf("%d", &a[i]); sum += a[i]; } for(int i = 0; i < m; ++i) { LL k; scanf("%I64d", &k); if(k > sum) printf("%d", 1); else printf("%d", 0); } printf("\n"); } return 0; }