import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class Hotel {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int counter = 0;
        HashMap<Integer,Integer> map = new HashMap<>(m, 0.75f);
        ArrayList<Integer> ans = new ArrayList<>(m);
        while(m > 0){
            m--;
            int i = scanner.nextInt();
            if(map.containsKey(i)){
                map.put(i,map.get(i) + 1);
            }
            else{
                map.put(i,1);
            }
        }
        for(Integer j : map.keySet()){
            if(map.get(j) >= n){
                ans.add(j);
                counter++;
            }
        }
        System.out.println(counter);
        for(Integer j : ans){
            System.out.print(j);
            System.out.print(" ");
        }
    }
}
