import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n=cin.nextInt();
int k=cin.nextInt();
int []a=new int[n];
//建立二叉排序树
BinaryTreeSort tree=new BinaryTreeSort();
for(int i=0;i<n;i++){
a[i]=cin.nextInt();
tree.insert(a[i]);
}
//tree.InorderTravel();
//查找元素
for(int i=1;i<=k;i++) {
int m = cin.nextInt();
if(tree.find(m)){
System.out.print(1+" ");
}
else{
System.out.print(0+" ");
}
}
System.out.println();
cin.close();
}
public static class BinaryTreeSort {
BinaryNode root;//根节点
public BinaryTreeSort(){
root=null;//初始化二叉排序树
}
//向二叉树插入元素,同时进行排序
public void insert(int i)
{
BinaryNode node=new BinaryNode(i);//新建节点
int count=-1;
if(root==null)//第一次插入的情况
{
root=node;
}
else {
BinaryNode p = root;
while (p != null)//插入节点
{
if (compare(p.getData(), i) == 1) //要插入的元素的值比根节点小
{
//左子树不为空
if (p.left != null) {
p = p.left;
}
//否则跳出当前循环
else {
count = 1;
break;
}
}
else {
if (p.right != null) {
p = p.right;
} else {
count = 0;
break;
}
}
}
if (count == 1) {
p.left = node;
} else if (count == 0) {
p.right = node;
}
}
}
public int compare(int data, int i) {
if(data>i)
return 1;
else if(data==i)
return 0;
else
return - 1;
}
public boolean find(int m) {
BinaryNode p=root;
while(p!=null){
int k=compare(p.getData(),m);
if(k==0)//如果k=0,则找到
{
return true;
}
else if(k==1)//当前节点大于寻找的值,向左
{
p=p.left;
}
else//否则向左
{
p=p.right;
}
}
return false;
}
void InorderTravel(){
travel(root);
}
void travel(BinaryNode T) {
if(T!=null){
travel(T.left);
System.out.println(T.getData()+" ");
travel(T.right);
}
}
}
//节点类
private static class BinaryNode {
BinaryNode left;//左子树
BinaryNode right;//右子树
int data;//数据域
public BinaryNode(int i) {
data=i;
left=null;
right=null;
}
public BinaryNode getLeft() {
return left;
}
public void setLeft(BinaryNode left) {
this.left = left;
}
public BinaryNode getRight() {
return right;
}
public void setRight(BinaryNode right) {
this.right = right;
}
public int getData() {
return data;
}
public void setData(int data) {
this.data = data;
}
}
}