#include <iostream>

using namespace std;

int main()
{
    int n, m, k = 0, s = 0;
    cin >> n >> m;
    int *A = new int[m];
    int *B = new int[m];
    for(int i = 0;i < m;i++){

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

        for(int j = i;j < m;j++){

            if(A[j] == A[i]){

                B[i]++;

            }
        }
         if(B[i] == n){

            s++;
        }
    }
    cout << s << '\n';
    for(int i = 0;i < m;i++){

        if(B[i] == n){

            cout << A[i] << " ";
        }
    }
    return 0;
}
