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

public class Main 
{ 
	public static void main(String[] args) throws Exception
	{
		Scanner sc = new Scanner(System.in) ; 
		PrintWriter out = new PrintWriter(System.out) ; 
		TreeSet<Integer> set = new TreeSet<>() ; 
		int q = sc.nextInt() , x = sc.nextInt() ; 
		for(int i = 0 ; i <= q  ; i++)
			set.add(i) ; 
		int next [] = new int [x] ; 
		while(q-->0)
		{
			int y = sc.nextInt() % x;
			set.remove(y + (next[y]++) * x) ; 
			out.println(set.first());
		}
		out.close();
	}
}