#include <bits/stdc++.h>
using namespace std;

int main ()
{
  int n, m;
  cin >> m;
  cin >> n;
  int sum = 0;
  int *arr = new int[n];
  int y[];

  for (int i = 0; i < n; i++)
  cin >> arr[i];

  map < int, int >mp;

  for (int i = 0; i < n; i++)
     mp[arr[i]]++;

  for (auto it = mp.begin (); it != mp.end (); it++)
    {
          if (it->second > 1)
	  sum++;

    }
    cout << sum << endl;
  for (auto it = mp.begin (); it != mp.end (); it++)
    {
          if (it->second > 1)
	  cout << it->first << " ";
    }
  return 0;
}
