#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    int N,K;
    //inputFile >> N >> K;
    scanf("%d", &N);
    scanf("%d", &K);
    int a,brojac=0;
    int* poz = new int[N] {};
    int* neg = new int[N] {};
    int* brojevi = new int[N*2] {};
    for (int i=0;i<N;i++) {
        //inputFile >> a;
        scanf("%d", &a);
        if (a >= 0) {
            poz[a]++;
        } else {
            neg[a*(-1)-1]++;
        }
    }

    for (int i=0;i<N;i++) {
        if (poz[i] >= K) {
            brojac++;
        }
    }
    for (int i=0;i<N;i++) {
        if (neg[i] >= K) {
            brojac++;
        }
    }
    printf("%d \n", brojac);
    for (int i=0;i<N;i++) {
        if (neg[i] >= K) {
            printf("%d ", (i+1)*(-1));
        }
    }
    for (int i=0;i<N;i++) {
        if (poz[i] >= K) {
            printf("%d ", i);
        }
    }
}