/******************************************
 *  Author : Atul Anand   
 *  Created On : Wed Jan 22 2020
 *  File : D.java
 *******************************************/

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

public class D{
    
    public static void main(String[] args) throws IOException {
        int Q=in.nextInt();
        long x=in.nextInt();
        HashSet<Long> set=new HashSet();
        long mex=0;
        for(int q=0;q<Q;q++){
            long y=in.nextInt();
            if(y<mex){
                long rem=mex-y;
                if(rem%x==0){
                    y=mex;
                }
                else{
                    y=y+x*(rem/x + 1);
                }
            }
            else{
                long rem=y-mex;
                if(rem%x==0){
                    y=mex;
                }
            }
            set.add(y);
            if(y==mex){
                while(set.contains(mex)){
                    mex++;
                }
            }
            println(mex);
        }
        
        in.close();
        out.close();
    }

    static int mod=1000000007;
    static Reader in=new Reader();
    static PrintWriter out = new PrintWriter(System.out);
    static void read(int arr[], int N) throws IOException{ for(int i=0;i<N;i++){ arr[i]=in.nextInt(); } }
    static void read(long arr[], int N) throws IOException{ for(int i=0;i<N;i++){ arr[i]=in.nextLong(); } }
    static void read(String arr[], int N) throws IOException{ for(int i=0;i<N;i++){ arr[i]=in.next(); } }
    static void print(Object O){ out.print(O); }
    static void println(Object O){ out.println(O); }
    static void print(int arr[]){ for(int i=0;i<arr.length;i++){ print(arr[i]+" "); } println(""); }
    static void print(int arr[][]){ for(int i=0;i<arr.length;i++){ print(arr[i]); } }
    static void debug(Object O){ System.out.println(O); }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader=new BufferedReader(new InputStreamReader(System.in));
        tokenizer=new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { tokenizer=new StringTokenizer(reader.readLine()); }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { return Integer.parseInt(next()); }
    double nextDouble() throws IOException { return Double.parseDouble(next()); }
    long nextLong() throws IOException { return Long.parseLong(next()); }
    String nextLine() throws IOException { return reader.readLine(); }
    void close() throws IOException { reader.close(); }
}