#include <stdio.h>
#include <stdlib.h>
#define INDEX(X, N) ((X) + (N))

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

  int *meta = (int *)calloc((2 * n + 1), sizeof(int));

  // printf("%d", INDEX(k, n));
  int br = 0;
  for (int i = 0; i < n; i++) {
    int nj;
    scanf("%d", &nj);
    meta[INDEX(nj, n)]++;
    br += meta[INDEX(nj, n)] == k;
  }
  printf("%d\n", br);

  for (int i = -n; i < n + 1; i++) {
    if (meta[INDEX(i, n)] >= k) printf("%d ", i);
  }

  return 0;
}