#include <bits/stdc++.h>
#define CODE_HERE ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
typedef long long ll;
using namespace std;
void solve()
{ 
    ll n, m, a;
    cin >> n >> m;

    vector <ll> vec;
    map <ll, ll> mp;

    for (int i = 0; i < m; i++)
    {
        cin >> a;
        mp[a]++;
    }

    for (auto it : mp)
    {
        if (it.second >= n)
        {
            vec.push_back(it.first);
        }
    }

    cout << vec.size() << endl;
    for (auto it : vec) cout << it << ' ';
}
int main()
{
    CODE_HERE;
    int t;
    for (t = 1; t > 0; t--) solve();
}