#pragma GCC optimize ("03,unroll-loops")
//#pragma GCC target ("avx,avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>

using namespace std;
//#define int long long
#define foru(i, x, n) for (int i = x; i < n; i++)
#define ford(i, x, n) for (int i = x; i >= n; i--)
#define forn(i, n) for (int i = 0; i < n; i++)
#define pb push_back
#define ft first
#define sd second
#define elif else if
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

template <typename T, typename Y>
istream& operator>> (istream& in, pair<T, Y>& a) {
    in >> a.first >> a.second;
    return in;
}

template <typename T>
istream& operator>> (istream& in, vector<T>& a) {
    forn(i, a.size())
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<< (ostream& out, vector<T>& a) {
    out << a[0];
    foru(i, 1, a.size())
        out << ' ' << a[i];
    out << '\n';
    return out;
}

const int MAX=1e9+1;
const double EPS = 1e-9;

void solve() {
    set<int> st;
    int n, m, x;
    map<int, int> mp;
    cin >> n >> m;
    forn(i, m) {
        cin >> x;
        mp[x]++;
        if (mp[x] == n)
            st.insert(x);
    }
    cout << st.size() << '\n';
    for (auto i:st)
        cout << i << ' ';
}

signed main()
{
    fast;
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}
