#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <set>
#include <map>
#include <iterator>
#define ll long long
using namespace std;

ll binpow(ll a, ll n){
    if(n == 0)
        return 1;
    else if(n % 2 == 1)
        return a * binpow(a, n - 1);
    else
        return binpow(a, n/2) * binpow(a, n/2);
}

ll n, m;
ll c[300009];
map <ll, ll> mp;

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= m; i++){
        cin >> c[i];
        mp[c[i]]++;
    }
    for(auto it : mp){
        if(it.second >= n)
            cout << it.first << " ";
    }
}
