#include <bits/stdc++.h>
using namespace std;
long long N,K,gran, sum;

struct clan{
    long long vr,ind,suma;
};
clan A[100011];

bool cmpvr(clan a, clan b){
    return a.vr<b.vr;
}
bool cmpind(clan a, clan b){
    return a.ind<b.ind;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> K;
    for(int i=1;i<=K;i++){
        cin >> A[i].vr;
        A[i].ind=i;
    }
    sort(A+1,A+K+1,cmpvr);
    for(int i=1;i<=K;i++){
        sum=0;
        for(int j=2;j<i;j++){
            if(A[i].vr%A[j].vr==0){
                sum^=A[j].vr;
            }
        }
        if(i==1){
            A[i].suma=1;
        }
        else{
            sum^=A[i].vr;
            sum^=1;
            A[i].suma=sum;
        }
    }
    sort(A+1,A+K+1,cmpind);
    for(int i=1;i<=K;i++){
        cout << A[i].suma << " ";
    }
    cout << endl;
}