#include <iostream>

using namespace std;

int main() {
    int N;
    int K;
    int niz[N];
    cin >> N >> K;
    int r=0;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        a = niz[r];
        r = r + 1;
    }
    int B;
    int druginiz[B];
    int b1=0;
    int brojac=0;
    for (int j = 0; j < N; j++) {
        if (niz[j] == niz[0]) {
            niz[j] = druginiz[b1];
            b1 = b1 + 1;
            brojac = brojac + 1;
        }
    }
    cout << brojac << endl;
    cout << druginiz << endl;
    return 0;
}