using System;
using System.Collections.Generic;

class HelloWorld {
    
    
  static void Main() {
    int n = Convert.ToInt32(Console.ReadLine());
    int m = Convert.ToInt32(Console.ReadLine());
    
    List<int> pees = new List<int>();
    
    for(int i = 0; i < m; i++){
        pees.Add(Convert.ToInt32(Console.ReadLine()));
    }
    
    List<int> mrv = new List<int>();
    
    while(pees.Count != 0){
        int k = pees[0];
        pees.Remove(k);
        int counter = 1;
        for (int i = 0; i < pees.Count; i++)
        {
            if (pees[i] == k)
            {
            counter++;
            pees.Remove(k);
            }
        }
        if (counter >= n)
        mrv.Add(k);
    }
    
    
    Console.WriteLine(mrv.Count);
    for(int i = 0; i < mrv.Count; i++){
        
        Console.Write(mrv[i]);
        if (i == mrv.Count - 1)
        Console.Write(" ");
    }
  }
}
