export {};
const input: String[] = require("fs").readFileSync(0,"utf8").toString().trim().split('\n');
const N_set:Set<number> = new Set(input[1].split(' ').map(Number));
const M_list:number[] = input[3].split(' ').map(Number);
M_list.forEach(v => console.log(N_set.has(v) ? 1 : 0));