#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,k,p=0;
    cin>>n>>k;
    int br[n+5];
    int r[n*2+5]= {0};
    for(int i=1; i<n+1; i++)
    {
        cin>>br[i];
        r[br[i]+n+1]=r[br[i]+n+1]+1;
        if(r[br[i]+n+1]==2)
        {
            p+=1;
        }
    }
    cout<<p<<endl;
    for(int i=1; i<=n*2+1; i++)
    {
        if(r[i]>=k)
        {

            cout<<i-n-1<<" ";
        }
    }

}