#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <bitset>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <vector>
#define fir first
#define sec second

using ll = long long;
template<typename T>
bool rMin(T& a, const T& b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool rMax(T& a, const T& b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

using namespace std;

struct Seg{
    int l;
    int r;
    int qfl;
    int qfr;
    int mqf;
    int lans;
    int rans;
    Seg operator+ (const Seg& an){
        Seg ans = *this;
        if(rMax(ans.mqf, an.mqf)){
            ans.lans = an.lans;
            ans.rans = an.rans;
        }
        if(qfl == r - l) ans.qfl += an.qfl;
        if(an.qfr == an.r - an.l) ans.qfr += ans.qfr;
        ans.r = an.r;
        if(rMax(mqf, qfr + an.qfl)){
            ans.lans = r - qfr;
            ans.rans = ans.l + ans.qfl;
        }
    }
};


vector<ll> pos_c;
vector<int> reqs;
map<ll, int> c_i;

void solve(){

    int qr, ms;
    char rt;
    cin >> ms >> qr;
    while(qr--){
        cin >> el;
        els.insert(el);
        eels.insert(el);
    }
    for(auto i : els){
        if(eels.count(i) >= mv) ans.push_back(i);
    }
    cout<< ans.size() << '\n';
    for(auto i : ans) cout << i << ' ';
    cout << '\n';

}

int main(){
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    cout.precision(10);
    int t = 1;

    //cin >> t;

    for(int i = 0; i < t; ++i){
        solve();
    }
}