#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N, K, numI, counter = 0;
    string outputS = "";

    cin>>N>>K;

    int* nizL = new int[N];
    int* nizD = new int[N];
    int nula = 0;

    for(int i = 0; i < N; i++)
    {
        nizL[i] = 0;
        nizD[i] = 0;
    }

    for(int i = 0; i < N; i++)
    {
        cin>>numI;
        if(numI < 0)
        {
            numI *= -1;
            nizL[numI - 1]++;
            if(nizL[numI - 1] == K)
            {
                if(counter > 0)
                    outputS += " ";
                outputS += to_string(numI * -1);
                counter++;
            }
        }
        else if(numI == 0)
        {
            nula++;
            if(nula == K)
            {
                if(counter > 0)
                    outputS += " ";
                outputS += "0";
                counter++;
            }
        }
        else
        {
            nizD[numI - 1]++;
            if(nizD[numI - 1] == K)
            {
                if(counter > 0)
                    outputS += " ";
                outputS += to_string(numI);
                counter++;
            }
        }
    }

    cout<<counter<<"\n"<<outputS;

    delete[] nizL;
    delete[] nizD;

    return 0;
}