#include <bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin >>n>>k;
vector <int> Count(2*n+2);
for(int i=0;i<n;i++){
    int x;
    cin >>x;
    Count[x+n+1]++;
}
int rez=0;
for(int i=0;i<2*n+2;i++){
    if(Count [i]>=k)rez++;
}
cout <<rez<<endl;
for(int i=0;i<2*n+2;i++){
   if(Count [i]>=k)cout <<i-n-1<<" ";
}
cout <<endl;
}