import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.*;
public class MyClass {
    public static void main(String[] args) throws Exception {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw=new PrintWriter(System.out);
        String s=br.readLine();
        String[] c=s.split(" ");
        int q=Integer.valueOf(c[0]);
        int x=Integer.valueOf(c[1]);
        TreeSet<Integer> ts=new TreeSet<>();
        for(int i=0; i<=q; i++)
            ts.add(i);
        int[] next=new int[x];
        while(q-->0) {
            s=br.readLine();
            int y=Integer.valueOf(s.trim())%x;
            ts.remove(y+(next[y]++)*x);
            pw.println(ts.first());
        }
        br.close();
        pw.close();
    }
}