#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using pi = pair<ll, ll>;
using vpi = vector<pi>;
const ll inf = 998244353;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n,m;
    cin >> n >> m;
    map<int, int> cnt;
    for(int i = 0; i < m; ++i){
        int x;
        cin >> x;
        cnt[x]++;
    }
    vector<int> ans;
    for(auto it : cnt){
        if(it.second == n || it.second == n + 1){
            ans.push_back(it.first);
        }
    }
    cout << ans.size() << '\n';
    for(int i : ans)cout << i << ' ';
}
