#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> vc(m);
    int cnt = 0, ans = 0;
    vector<int> s;
    for(int i = 0; i < m; i++)
    {
        cin >> vc[i];
    }
    for(int i = 0; i < m; i++)
    {
        for(int j = i; j < m; j++)
        {
            if(vc[i] == vc[j]) cnt++;
        }
        if(cnt == n)
        {
            ans++;
            s.push_back(vc[i]);
        }
        cnt = 0;
    }
    cout << ans << endl;
    for(int i = 0; i < ans; i++) cout << s[i] << " ";
}
