#include<bits/stdc++.h>
using namespace std;
long long poz[1000020],neg[1000020],a[1000020];
long long n,k,br;
long long dobri[1000005];
long long dobribr;
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]>=0)
        {
            poz[a[i]]++;
        }
        else
        {
            neg[a[i]*-1]++;
        }
    }
    for(int i=0;i<=n;i++)
    {
        if(poz[i]>=k)
        {
            br++;
            dobribr++;
            dobri[dobribr]=i;
        }
    }
    for(int i=0;i<=n;i++)
    {
        if(neg[i]>=k)
        {
            br++;
            dobribr++;
            dobri[dobribr]=i*-1;
        }
    }
    cout<<br<<endl;
    for(int i=1;i<=dobribr;i++)
    {
        cout<<dobri[i]<<" ";
    }
    cout<<endl;
    return 0;
}