import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

immutable long INF = 1L << 59;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto A = readln.split.map!(to!int).array;

    auto cnt1 = new int[](N+10);
    auto cnt2 = new int[](M+10);
    cnt2[0] = N;
    auto ans = new dchar[](M);
    int mv = 0;

    foreach (i; 0..M) {
        bool ok = false;
        if (cnt1[A[i]] == mv && cnt2[cnt1[A[i]]] == 1) {
            ok = true;
            mv += 1;
        }
        cnt2[cnt1[A[i]]] -= 1;
        cnt1[A[i]] += 1;
        cnt2[cnt1[A[i]]] += 1;
        if (ok) {
            ans[i] = '1';
        } else {
            ans[i] = '0';
        }
    }

    ans.writeln;
}
