#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define MAXN 2000006
typedef long long ll;


using namespace std;

int n,k;
int niz[MAXN];
vector<int> res;
int main()///STAVI LL
{
    scanf("%d %d", &n, &k);
    for(int i=1;i<=n;i++){
        int t;
        scanf("%d", &t);
        niz[t+n]++;
    }
    for(int i=0;i<MAXN;i++){
        if(niz[i]>=k)res.pb(i-n);
    }
    printf("%d\n",res.size());
    for(auto x:res)printf("%d ",x);
    return 0;
}
/**//**//**//**//**//**//**//**//**//**//**//**////sui