#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #pragma comment(linker, "/STACK:102400000,102400000") typedef long long LL; typedef pair PII; typedef pair PIII; typedef vector vec; typedef vector mat; #define PB push_back #define FI first #define SE second #define gcd(x, y) __gcd(x, y) #define gcd3(x, y, z) __gcd(__gcd(x, y), z) const double EPS = 1e-30; const double PI = acos(-1.0); const int INF = 0x3f3f3f3f; const LL INFL = 0x3f3f3f3f3f3f3f3fLL; const int MAXN = 100000 + 10; const LL MOD = 1000000007; int main() { int T; scanf("%d", &T); while (T--) { int n, m; scanf("%d%d", &n, &m); LL sum = 0; for (int i = 0; i < n; ++i) { LL x; scanf("%I64d", &x); sum += x; } while (m--) { LL q; scanf("%I64d", &q); putchar(q > sum ? '1' : '0'); } puts(""); } return 0; }