import java.io.*;
import java.util.*;  
public class main {	

	public static void main(String[] args) throws NumberFormatException, IOException
	{
		BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw= new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		int q = Integer.parseInt(st.nextToken());
		int x = Integer.parseInt(st.nextToken());
		Queue<Integer>[] arr = new LinkedList[x];
		TreeSet<Integer> set = new TreeSet<Integer>();
		for (int i = 0; i < arr.length; i++) {
			arr[i]= new LinkedList<Integer>();
		}
		for (int i = 0; i < q+1; i++) {
			arr[i%x].add(i);
			set.add(i);
		}
		for (int i = 0; i < q; i++) {
			int temp = Integer.parseInt(br.readLine());
			if(!arr[temp%x].isEmpty())
			set.remove(arr[temp%x].peek());
			arr[temp%x].poll();
			pw.println(set.first());
		}
		pw.close();
	}
}