#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, k, i, j, br = 0, b = 0;
    vector<int> oznake;
    cin >> n >> k;
    int a[n];
    for(i=0;i<n;i++)
        cin >> a[i];
    for(i=-n;i<=n;i++)
    {
        for(j=0;j<n;j++)
        if(a[j] == i)
            b++;
        if(b >= k)
        {
            br++;
            oznake.push_back (i);
        }
        b=0;
    }
    cout << br << "\n";
    for(i=0;i<br;i++)
        cout << oznake[i] << " ";

    return 0;
}