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

public class Question1 {
    static void sort(int[] a) {
        shuffle(a);
        Arrays.sort(a);
    }

    public static ArrayList<Integer>  primeFactors(int n)
    {   ArrayList<Integer> fact = new ArrayList<Integer>();
        // Print the number of 2s that divide n
        while (n % 2 == 0) {
            fact.add(2);
            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) {
                fact.add(i);
                n /= i;
            }
        }


        if (n > 2)
            fact.add(n);
        return fact;
                }
    static void shuffle(int[] a) {
        int n = a.length;
        Random rand = new Random();
        for (int i = 0; i < n; i++) {
            int tmpIdx = rand.nextInt(n);
            int tmp = a[i];
            a[i] = a[tmpIdx];
            a[tmpIdx] = tmp;
        }
    }

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner();
        int mex=0;
        Hashtable<Integer,Integer> notUsed =  new Hashtable<Integer,Integer>();
                int q=sc.nextInt();
        int x=sc.nextInt();
        for(int i=0;i<q;i++){
            int y=sc.nextInt();
            if(y%x==mex){
                mex++;
            }
            else{

                if(notUsed.containsKey(y%x)){
                    notUsed.put(y%x,notUsed.get(y%x)+1);
                }else{
                    notUsed.put(y%x,1);
                }
               while(notUsed.containsKey(mex%x)){

                   if(notUsed.get(mex%x)>1){
                       notUsed.put(mex%x,notUsed.get(mex%x)-1);
                   }else{
                       notUsed.remove(mex%x);
                   }
                   mex++;
               }
            }
            System.out.println(mex);
        }
    }
}
class Pair implements  Comparable{
    public int compareTo(Object o){
        Pair p = (Pair)o;
        if(this.x>p.x){
            return 1;
        }else if(this.x<p.x){
            return -1;
        }else{
            if(this.y>p.y){
                return 1;
            }else if(this.y<p.y){
                return -1;
            }
        }
        return 0;
    }
    int x;
    int y;
    public Pair(int x,int y){
        this.x=x;
        this.y=y;
    }
}
     class Scanner {
        BufferedReader br;
        StringTokenizer st;

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

        Scanner(String fileName) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(fileName));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

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

        long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }

        boolean ready() throws IOException {
            return br.ready();
        }

        int[] nxtArr(int n) throws IOException {
            int[] ans = new int[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextInt();
            return ans;
        }

    }


