#include <bits/stdc++.h>
using namespace std;
#define int long long

const int N = 3e5 + 100 ;

int a[N] ;

signed main() {

    map < int , int > mp ;
    vector < int > v ;
    int n , m ;
    cin >> n >> m ;
    for ( int i = 0 ; i < m ; i++ )
    {
        cin >> a[i] ;
        mp[a[i]]++ ;
    }
    for ( auto i: mp )
    {
        if ( i.second >= n )
        {
            v.push_back( i.first ) ;
        }
    }

    cout << v.size() << '\n' ;
    for ( int i: v )
    {
        cout << i << ' ' ;
    }

}