#include <bits/stdc++.h>
#define ll long long
#define si short int

using namespace std;
int main(void)
{
    ll n,k;
    cin>>n>>k;
    ll a[n+2][2]={0};
    ll brc=0;
    vector<ll> resenja;
    for(ll i=0;i<n;i++)
    {
        ll x;
        cin>>x;
        if(x>=0)
        {
            if(a[x][1]!=-1)
            {
                a[x][1]++;
                if(a[x][1]>=k)
                {
                    //cout<<x<<endl;
                    resenja.push_back(x);
                    a[x][1]=-1;
                }
            }
        }
        else
        {
            x=-x;
            if(a[x][0]!=-1)
            {
                a[x][0]++;
                if(a[x][0]>=k)
                {
                    //cout<<-x<<endl;
                    resenja.push_back(-x);
                    a[x][0]=-1;
                }
            }
        }
    }
    cout<<resenja.size()<<endl;
    for(ll i=0;i<resenja.size();i++)
        cout<<resenja[i]<<' ';
}