#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <array>
#include <deque>
#include <queue>
#include <map>
#include <set>
#define KholiD freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define KK ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define ld long double
using namespace std ;
/**

“So verily, with the hardship, there is a relief.” [Quran 94:5]

**/

void solve(){
    ll n , m ;
    cin >> n >> m ;
    ll a[m] ;
    set <ll> st ;
    map <ll,ll> mp ;
    for ( ll &i : a )
        cin >> i , st.insert ( i ) , mp[i] ++ ;
    vector <ll> ans ;
    for ( ll i : st )
        if ( mp[i] >= n )
            ans.push_back ( i ) ;
    cout << ans.size() << endl ;
    for ( ll i : ans )
        cout << i << ' ' ;
}

int main(){KK
    ll t = 1 ;
    ///cin >> t ;
    while ( t -- )
        solve () ;
}
