#include #include #include #include #include #include #include #include #include #include #include #include #include #define PI acos(-1.0) #define ll long long #define INF 0x3f3f3f3f #define eps 1e-6 #define rep(i, a, n) for(int (i) = (a); (i) <= (n); (i)++) #define per(i, n, a) for(int (i) = (n); (i) >= (a); (i)--) #define For(i, a, n) for(int (i) = (a); (i) < (n); (i)++) #define mset(x) memset((x), 0, sizeof((x))) #define meset(x) memset((x), -1, sizeof((x))) #define pb push_back #define mp make_pair #define sf scanf #define pf printf #pragma comment(linker, "/STACK:1024000000,1024000000") #define mod 1000000007 using namespace std; int a[100004]; int main() { int re; sf("%d", &re); while(re--) { int n, m; sf("%d%d", &n, &m); ll sum = 0; for(int i = 0; i < n; i++) { int x; sf("%d", &x); sum += x; } for(int i = 0; i < m; i++) { ll x; sf("%I64d", &x); if(x > sum) a[i] = 1; else a[i] = 0; } for(int i = 0; i < m; i++) pf("%d", a[i]); pf("\n"); } }