import java.io.*;
import java.lang.*;
import java.util.*;

//https://codeforces.com/contest/1294/problem/D
public class MEX{

    public static void main(String args[]){
        ArrayList<Integer> a = new ArrayList<Integer>();
        HashMap<Integer, Integer> counterMap = new HashMap<Integer, Integer>();
        try{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            int inp[] = Arrays.stream(br.readLine().split("\\s")).mapToInt(Integer::parseInt).toArray();
            int q = inp[0];
            int x = inp[1];
            MEX M = new MEX();
            for(int i=0; i<q; i++){
                int j = Integer.parseInt(br.readLine());
                a.add(j);
                if(counterMap.get(j) == null){
                    counterMap.put(j,1);
                } else {
                    counterMap.put(j,counterMap.get(j)+1);
                }
                System.out.println(M.findMEX(a, x, counterMap));
            }

        } catch(IOException ioe){
            //do nothing.
        }
    }

    //returns YES if possible, NO otherwise
    int findMEX(ArrayList<Integer> a, int x, HashMap<Integer, Integer> counterMap){
        if(a.size() == 1){
            if(a.get(0) == 0){
                return 1;
            } else {
                int t = a.get(0)-1;
                a.set(0,t);
                return t;
            }
        }
        Iterator iter = a.iterator();
        int mex = 0, counter=0;
        while(iter.hasNext()){
            int e = (int) iter.next();
            if(counter == e){
                counter++;
                continue;
            }
        }
        mex = counter; //natural value without incrementing
        iter = a.iterator();
        while(iter.hasNext()){
            int e = (int) iter.next();
            if(e-x > 0 && e-x == counter && counterMap.get(e) >1){
                counter++;
            } else if(e-x < 0 && e+x == counter && counterMap.get(e) >1 ){
                counter++;
            }
        }
        mex = counter;
        return mex;
    }

}