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

int n;
int k;
int a;
int resNum = 0;

vector<int> dartBoard(0,0);

int main()
{
    cin >> n >> k;

    dartBoard.resize(2*n+1);

    for (int i = 0; i < n; i++) {
        cin >> a;
        a = a + n;
        dartBoard[a] = dartBoard[a]+1;
    }


    for (int i = 0; i < 2*n+1; i++) {
        if (dartBoard[i] >= k) {
            resNum++;
        }
    }

    cout << resNum;
    cout << endl;

    for (int i = 0; i < 2*n+1; i++) {
        if (dartBoard[i] >= k) {
            cout << i - n << " ";
        }
    }

}