#include<iostream>
#include<stdio.h>
#include<cstdio>
using namespace std;
int N,K,B,A,niz1[1000005],niz2[1000005],rednib[1000005];
int main(){
//freopen ("tester23.txt","r",stdin);
scanf ("%d %d",&N,&K);
//cout<<K<<endl;
for(int i=1;i<=N;i++){
    scanf ("%d",&A);
    if(A>0){
        niz2[A]++;
    }
    else if(A<0){
        niz1[-1*A]++;
    }
    else{
        niz2[0]++;
    }
}
int a=1;
for(int i=0;i<=1000000;i++){
    if(niz2[i]>=K){
        B++;
        rednib[a]=i;
        a++;
    }
    if(niz1[i]>=K){
        B++;
        rednib[a]=-1*i;
        a++;
    }
   // cout<<a<<endl;
}
//return 5;

cout<<B<<endl;
for(int i=1;i<=a-1;i++){
    cout<<rednib[i]<<" ";
}
 return 0;
}