#include <stdio.h>

int main()
{
    long long n,k;
    scanf("%lld%lld",&n,&k);
    long long a[n+10],b[n+10],c[n+10];
    for (long long i=0;i<n;i++)
    {
        b[i]=0;
        c[i]=0;
    }
    for (long long i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        if (a[i]>=0) b[a[i]]++;
        else c[-a[i]]++;
    }
    long long br=0;
    for (long long i=0;i<n;i++)
        if (b[i]>=k || c[i]>=k) br++;
    printf("%lld\n",br);
    for (long long i=0;i<n;i++)
        if (b[i]>=k) printf("%lld ",i);
    for (long long i=1;i<n;i++)
        if (c[i]>=k) printf("%lld ",-i);
    return 0;
}