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

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        
        int meh = 0;
        
        var qx = in.readLine().split("\\s");

        int q = Integer.parseInt(qx[0]);
        int x = Integer.parseInt(qx[1]);

        int[] arr = new int[x];
        for (int i =0; i < x; i++) {
            arr[i] = i-x;
        }
        
        for (int i = 0; i < q; i++) {
            int y = Integer.parseInt(in.readLine());
            arr[y % x] += x;
            while (arr[meh % x] >= meh) {
                meh += 1;
            }
            System.out.println(meh);
        }

        
    } 
}


class Solution {
    static void solve(   ) {
        


    }
}