/*
    It is the level of one's commitment that determines the success, far more than the knowledge one possess.
    
    I never lose, I either win or I learn.
                - Competitive Programming

*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class TaskD {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);

        st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int x = Integer.parseInt(st.nextToken());

        HashSet<Integer> hs = new HashSet<>();

        int[] need = new int[x];

        for(int i=0 ; i<x ; i++) {
            need[i] = i;
        }

        int mex = 0;
        for(int i=0 ; i<n ; i++) {
            int curr = Integer.parseInt(br.readLine());
            int mod = curr%x;
            hs.add(need[mod]);
            need[mod] += x;

            while (hs.contains(mex)) mex++;

            pw.println(mex);
        }

        
        
        
        
        
        
        
        pw.flush();
        pw.close();
    }
}
