#include <iostream>

using namespace std;
int p[1000001];
int pn[1000001];
int main()
{


    int n,k;

    cin>>n>>k;

    int tin;
    for(int i=0;i<n;i++)
    {

        cin>>tin;
        if(tin>=0)
            p[tin]++;
        else
            pn[-tin]++;

    }
    int br=0;
    int out[2*n+2];
    int ind=0;

    for(int i=0;i<=n;i++)
    {

        if(p[i]>=k)
        {
            out[ind++]=i;
            br++;
        }

        if(pn[i]>=k)
        {
            out[ind++]=-i;
            br++;
        }
    }

    cout<<br<<"\n";

    for(int i=0;i<ind;i++)
        cout<<out[i]<<" ";


    return 0;
}