#include <iostream>
#include <stdio.h>
#include <vector>

#define MAXN 2000001

using namespace std;

void ispis(vector <int> &a)
{
    cout<<a.size()<<endl;
    for(int i=0;i<a.size();i++)
        cout<<a[i]<<" ";
    cout<<endl;
}

int main()
{
    int n,k,b;
    scanf("%d %d",&n,&k);
    vector <int> a(2*n+1,0),x;
    for(int i=0;i<n;i++){
        scanf("%d",&b);
        a[b+n]++;
    }
    //ispis(a);
    for(int i=0;i<2*n+1;i++)
        if(a[i]>=k)
            x.push_back(i-n);
    ispis(x);

    return 0;
}