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

public class D 
{

	public static void main(String[] args) throws IOException 
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		String[] inp = br.readLine().split(" ");
		int q = Integer.parseInt(inp[0]);
		int x = Integer.parseInt(inp[1]);
		long[] arr = new long[x];
		int ans=0;
		while(q-->0)
		{
			int temp = Integer.parseInt(br.readLine());
			arr[temp%x]++;
			while(arr[ans%x]>0)
			{
				arr[ans%x]--;
				ans++;
			}
			pw.println(ans);
		}
		pw.flush();
	}

}
