#include #include #include using namespace std; const int N = 100100; int n, m; int a[N]; const long long mod = 1000000000000000000LL; //1000000000000000000; int main(void) { int n, m; int T; // cout << mod << endl; scanf("%d", &T); while(T--) { int i; long long sum = 0; scanf("%d%d", &n, &m); for(i = 0; i < n; i++) { scanf("%d", &a[i]); if(sum <= mod) sum += a[i]; } long long q; for(i = 0; i < m; i++) { scanf("%I64d", &q); if(q > sum) printf("1"); else printf("0"); } printf("\n"); } return 0; }