The only difference between easy and hard versions are constraints on n and k.

You are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most k most recent conversations with your friends. Initially, the screen is empty (i.e. the number of displayed conversations equals 0).

Each conversation is between you and some of your friends. There is at most one conversation with any of your friends. So each conversation is uniquely defined by your friend.

You (suddenly!) have the ability to see the future. You know that during the day you will receive n messages, the i-th message will be received from the friend with ID id_i (1 ≤ id_i ≤ 10^9).

If you receive a message from id_i in the conversation which is currently displayed on the smartphone then nothing happens: the conversations of the screen do not change and do not change their order, you read the message and continue waiting for new messages.

Otherwise (i.e. if there is no conversation with id_i on the screen):

  * Firstly, if the number of conversations displayed on the screen is k, the last conversation (which has the position k) is removed from the screen. 
  * Now the number of conversations on the screen is guaranteed to be less than k and the conversation with the friend id_i is not displayed on the screen. 
  * The conversation with the friend id_i appears on the first (the topmost) position on the screen and all the other displayed conversations are shifted one position down. 



Your task is to find the list of conversations (in the order they are displayed on the screen) after processing all n messages.

Input

The first line of the input contains two integers n and k (1 ≤ n, k ≤ 200) — the number of messages and the number of conversations your smartphone can show.

The second line of the input contains n integers id_1, id_2, ..., id_n (1 ≤ id_i ≤ 10^9), where id_i is the ID of the friend which sends you the i-th message.

Output

In the first line of the output print one integer m (1 ≤ m ≤ min(n, k)) — the number of conversations shown after receiving all n messages.

In the second line print m integers ids_1, ids_2, ..., ids_m, where ids_i should be equal to the ID of the friend corresponding to the conversation displayed on the position i after receiving all n messages.

Examples

Input


7 2
1 2 3 2 1 3 2


Output


2
2 1 


Input


10 4
2 3 3 1 1 2 1 2 3 3


Output


3
1 3 2 

Note

In the first example the list of conversations will change in the following way (in order from the first to last message):

  * []; 
  * [1]; 
  * [2, 1]; 
  * [3, 2]; 
  * [3, 2]; 
  * [1, 3]; 
  * [1, 3]; 
  * [2, 1]. 



In the second example the list of conversations will change in the following way:

  * []; 
  * [2]; 
  * [3, 2]; 
  * [3, 2]; 
  * [1, 3, 2]; 
  * and then the list will not change till the end. 
//package div3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class board
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }



    /*
            BABB
            BAABBB

            AAAAABBB

    *  AABBBABBBB
    *
    * AABABB
    *
    * */
    static void helper(String s,int[] a,int n,String match,int inc){
        int i=0;
        while(i<n){
            int j = i;
            if(j+inc-1<=n-1 && s.substring(j,j+inc).equals(match)){
                a[j] = 1;
                i = j+inc-1;
            }
            else{
                i++;
            }
        }

    }
    static final int MAXN = 100000;
    static final int level = 18;



    //static LinkedList<Integer>[] adj;


    static int[] diameter;
    static int bfs(int init, int n)
    {
        // Initializing queue
        Queue<Integer> q = new LinkedList<>();
        q.add(init);

        int visited[] = new int[n + 1];
        for (int i = 0; i <= n; i++)
        {
            visited[i] = 0;
            diameter[i] = 0;
        }

        // Pushing each node in queue
        q.add(init);

        // Mark the traversed node visited
        visited[init] = 1;
        while (q.size() > 0)
        {
            int u = q.peek();
            q.remove();
            for (int nei : adj[u])
            {
                if (visited[nei] == 0)
                {
                    visited[nei] = 1;

                    // Considering weight of edges equal to 1
                    diameter[nei] += diameter[u] + 1;
                    q.add(nei);
                }
            }
        }
        int in = 0;
        for(int i = 0; i <= n; i++)
        {
            if(diameter[i] > diameter[in])
                in = i;
        }

        // return index of max value in diameter
        return in;
    }
    private static int dfs(int node,LinkedList<Integer>[] adj,int parent,int[] sub){

        int size = 1;
        for(int nei : adj[node]){
            if(nei != parent){
                size += dfs(nei,adj,node,sub);
            }
        }
        sub[node] = size;
        return size;
    }
    private static int dfs2(int node,LinkedList<Integer>[] adj,int parent,int[] sub){
        int res = sub[node];
        int maxScore = 0;
        for(int nei : adj[node]){
            if(nei != parent) {
                maxScore = Math.max(maxScore,dfs2(nei,adj,node,sub));
            }
        }
        return res + maxScore;
    }
    public static void primeFactors(long n)
    {
        // Print the number of 2s that divide n
        while (n%2==0)
        {
            primesMap.put((long)2,primesMap.getOrDefault((long)2,0)+1);
            n /= 2;
        }

        // n must be odd at this point.  So we can
        // skip one element (Note i = i +2)
        for (int i = 3; i <= Math.sqrt(n); i+= 2)
        {
            // While i divides n, print i and divide n
            while (n%i == 0)
            {
                primesMap.put((long)i,primesMap.getOrDefault((long)i,0)+1);
                n /= i;
            }
        }

        // This condition is to handle the case whien
        // n is a prime number greater than 2
        if (n > 2)
            primesMap.put(n,primesMap.getOrDefault(n,0)+1);
    }
    static TreeMap<Long,Integer> primesMap;
    /*
    *
    *  2 2 2 1 3 4 5
    *  1 2 2 2 3 3 2 1 2 2 2
    * */
    static LinkedList<Integer>[] adj;
    static int[] color;
    static int[] parent;
    static int cycle_end;
    static int cycle_start;
    static int n;
    static HashSet<Integer> cycle;
    static boolean dfs(int v, int par) { // passing vertex and its parent vertex
        color[v] = 1;
        for (int u : adj[v]) {
            if(u == par) continue; // skipping edge to parent vertex
            if (color[u] == 0) {
                parent[u] = v;
                if (dfs(u, parent[u]))
                    return true;
            } else if (color[u] == 1) {
                cycle_end = v;
                cycle_start = u;
                return true;
            }
        }
        color[v] = 2;
        return false;
    }
    static void find_cycle() {
        Arrays.fill(color,0);
        Arrays.fill(parent,-1);
        cycle_start = -1;

        for (int v = 0; v <= n; v++) {
            if (color[v] == 0 && dfs(v, parent[v]))
                break;
        }



        cycle.add(cycle_start);
        for (int v = cycle_end; v != cycle_start; v = parent[v])
            cycle.add(v);
        cycle.add(cycle_start);
        //System.out.println(cycle);

    }
    static int dfs2(int node,int par){
        int s = 1;
        for(int nei: adj[node]){
            if(!cycle.contains(nei) && nei != par){
                s += dfs2(nei,node);
            }
        }
        return s;
    }
    static long nC2(int n){
        return ((long)(n)*(long)(n-1))/2;
    }
    static int[][] d = new int[][]{{0,0},{1,0},{0,1},{1,1}};
    static Long[][] dp;
    static long go(int start,int i,long[] f,long[] cost,long fuel,int started){
        int s = start,ss = started;
        //System.out.println(fuel);
        if(start != -1 && fuel<0) return Integer.MAX_VALUE;
        if(i >= f.length){
            //System.out.println(start+" "+fuel);
            if(start == -1 ) return Integer.MAX_VALUE;
            if(fuel+1 >= (f.length-(i-1-start))) return 0;
            else return Integer.MAX_VALUE;
        }
        if(start != -1 && dp[i][start] != null) return dp[i][start];
        long totCost = Long.MAX_VALUE;
        if(start == -1) {
            //fuel = 0;
            start = i;
            started = 1;
        }
        fuel += f[i];
        //System.out.println(fuel);
        totCost = Math.min(totCost,cost[i]*f[i] + go(start,i+1,f,cost,fuel-1,started));
        fuel -= f[i];

        totCost = Math.min(totCost,go(s,i+1,f,cost,(s == -1)?0:fuel-1,ss));


        if(s == -1)return totCost;
        return dp[i][s] = totCost;

    }
//    static int go(int index,int x,int k){
//        if(index-k > x || index+)
//        if(index == x) return 0;
//        int op1 = 1+go(index+k,x,k+1);
//        int op2 = 1+go(index-1,x,k+1);
//        return Math.min(op1,op2);
//    }

    public static  int quadraticEquationRoot1(double a, double b, double c){
        double root1, root2; //This is now a double, too.
        root1 = (-b + Math.sqrt(Math.pow(b, 2) - 4*a*c)) / (2*a);
        root2 = (-b - Math.sqrt(Math.pow(b, 2) - 4*a*c)) / (2*a);
        int min = Integer.MAX_VALUE;
        if(root1 >= 0 && root1<min && Math.ceil(root1) == root1)min = (int)root1;
        if(root2 >= 0 && (int)root2<min && Math.ceil(root2) == root2)min = (int)root2;
        if(min == Integer.MAX_VALUE) return -1;
        return min;
}
    static void print(int[] days){
        for(int i:days)out.print(i+" ");
        out.println();
    }
    static void print(int[][] a){
        for(int[] f:a){
            out.println();
            for(int i:f){
                out.print(i+" ");
            }
        }
        out.println();
    }
    static PrintWriter out;
    static int[] pre;

    static int XOR(int l,int r){
        if(l == 0){
            return pre[r];
        }
        else{
            return pre[r]^pre[l-1];
        }
    }
    static int m = (int)(1e9+7);
    static long prod(long a,long b){
        return (a%m * b%m)%m;
    }
    static List<Long> dfs(int node,LinkedList<Integer>[] adj,int[] a){
        List<Long> ret = new ArrayList<>();
        for(int nei:adj[node]){
            List<Long> get = dfs(nei,adj,a);
            for(long e:get) ret.add(e);
        }
        if(ret.isEmpty()){
            ret.add((long)a[node]);
            return ret;
        }
        Collections.sort(ret);
        long max = ret.get(ret.size()-1);
        int needed = a[node];
        for(int i=0;i<ret.size();i++){
            long diff = max-ret.get(i);
            if(needed > diff){
                ret.set(i,ret.get(i)+diff);
                needed -= diff;
            }
            else{
                ret.set(i,ret.get(i)+needed);
                needed = 0;
                break;
            }
        }
        if(needed > 0){
            for(int i=0;i<ret.size();i++){
                ret.set(i,ret.get(i)+needed/ret.size());
            }
            if(needed%ret.size() != 0){
                ret.set(0,ret.get(0)+needed%ret.size());
            }

        }
        return ret;

    }
    static int manhattan(int[] a,int[] b){
        return Math.abs(a[0]-b[0])+Math.abs(a[1]-b[1]);
    }
    static boolean satisfy(int[] head,int r,int c,int[][] pre,int[][] suf){
        int diff = r-head[1];
        int want = (1+(diff)*(2))/2 + 1;
        if(pre[r][c] >= want && suf[r][c] >= want) return false;
        return true;
    }
    public static void main(String[] args)
    {
        FastReader sc=new FastReader();
        out = new PrintWriter(System.out);
        //int t = sc.nextInt();

        //while(t-->0) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            int[] a = new int[n];
            for(int i=0;i<n;i++) a[i] =sc.nextInt();

            Deque<Integer> deque = new ArrayDeque<>();

            for(int i=0;i<n;i++){
                //out.println(deque);
                while(!deque.isEmpty() && deque.size() > k){
                    deque.pollLast();
                }
                if(!deque.contains(a[i]))
                    deque.addFirst(a[i]);
            }
        while(!deque.isEmpty() && deque.size() > k){
            deque.pollLast();
        }
        out.println(deque.size());
        while(!deque.isEmpty()) out.print(deque.pollFirst()+" ");
        out.println();






        out.close();
    }


}