#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
    ll n , m ;
    cin >> n >> m ;
    map <ll,ll> mp ;
    set <ll> s ;
    vector <ll> v ;
    for ( ll i=0; i<m; i++ ){
        ll a ;
        cin >> a ;
        mp[a] ++ ;
        s.insert ( a ) ;
    }
    for ( auto i : s ){
        if ( mp[i] >= n )
            v.push_back ( i ) ;
    }
    cout << v.size() << endl ;
    for ( ll i=0; i<v.size(); i++ )
        cout << v[i] << ' ' ;
}
