//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64

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

int main() {
    int n, k;
    cin >> n >> k;
    
    vector<int> meta(2 * n + 1, 0);
    
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        
        meta[x + n]++;
    }
    
    int l = 0;
    
    for (int i = 0; i < 2 * n + 1; i++) if (meta[i] >= k) l++;
        
    cout << l << endl;
    
    
    for (int i = 0; i < 2 * n + 1; i++) if (meta[i] >= k) cout << (i - n) << " ";
        
    cout << endl;
    
    return 0;
}