#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n, k;
    scanf("%d%d", &n, &k);

    int *meta = (int*)calloc( 2*n+1, sizeof(int));
    for (int i = 0; i < n; ++i)
    {
        int t;
        scanf("%d", &t);
        meta[t+n]++;
    }

    int brojac = 0;
    for (int i = 0; i < 2*n+1; ++i)
        if ( meta[ i ] >= k ) brojac++;

    printf("%d\n", brojac);

    for (int i = 0; i < 2*n+1; ++i)
        if ( meta[ i ] >= k ) printf("%d ", i - n );

    return 0;
}