#include <iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
    long br = 0;
    long N,K;

    cin>>N>>K;

    long niz1[N];
    long niz2[N+1];
    long krajniNiz[N/2];

    for(long i = 0; i < N; i++)
    {
        niz1[i] = 0;
        niz2[i] = 0;
    }
    niz2[N]=0;

    for(long i = 0; i < N; i++)
    {
        long p;
        cin>>p;
        if(p>0)
        {
            if(niz1[p-1]+1==K) br++;
            niz1[p-1]+=1;
        }
        else
        {
            p=abs(p);
            if(niz2[p]+1=K) br++;
            niz2[p]+=1;
        }
    }

    cout<<br<<"\n";
    for(long i = 0; i < N; i++)
    {
        if(niz1[i]>=K) cout<< i+1<<" ";
        if(niz2[i]>=K) cout<<-i<<" ";
    }
    if(niz2[N]>=K) cout<<-N<<" ";
}