#include #include #include #include #include #include #define LL long long #define pb push_back using namespace std; const int N = 100010; int a[N]; char ans[N]; int main() { int T; scanf("%d", &T); while (T--) { int n, m; scanf("%d%d", &n, &m); LL sum = 0; for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]); sum += a[i]; } for (int i = 1; i <= m; ++i) { LL x; scanf("%I64d", &x); if (x > sum) ans[i] = '1'; else ans[i] = '0'; } for (int i = 1; i <= m; ++i) putchar(ans[i]); puts(""); } return 0; }