#include <bits/stdc++.h>

using namespace std;

int main()
{
    int N,K;

    scanf("%d%d",&N,&K);
    int arr[N];
    int sol[2*N+1];
    for(int i = 0; i < N; ++i){
        scanf("%d",&arr[i]);

    }
    for(int i = 0; i < ((2*N) +1);++i) sol[i] = 0;

    for(int i = 0; i < N;++i){
        int b;
        if (arr[i] == 0) b = 0;
        else if(arr[i]>0) b = arr[i];
        else if(arr[i]<0) b = arr[i]*(-1) + N;
       sol[b]+=1;
    }
    /*printf("\n");
    for(int i = N+1; i < 2*N+1 ;++i){
       int s = i;
       if(s > N) s = (s-N)*(-1);
       printf("%d:%d ", s,sol[i]);
    }
    for(int i = 0; i <= N ;++i){
      printf("%d:%d ",i,sol[i]);
    }*/
    int arr1[N];
    int r = 0;
    int p =0;
    for(int i = 0; i < 2*N+1;++i){
        if(sol[i] >= K){
            r++;
            if(i > N)
                arr1[p] = (i-N)*(-1);
            else arr1[p] = i;
            p++;
        }
    }
    printf("%d\n",r);
    for(int i = 0; i < r; ++i)
        printf("%d ",arr1[i]);
}