import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Scanner;
import java.util.StringTokenizer;
 
public class Main {
	static int MOD = (int) (1e9 +7);
	
	public static void main(String[] args) throws NumberFormatException, IOException
	{
		//BufferedReader br = new BufferedReader(new FileReader("input.txt"));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st ;
		Scanner sc = new Scanner(System.in);
		//PrintWriter out = new PrintWriter("output.txt");
		PrintWriter out = new PrintWriter(System.out);
		int Q = sc.nextInt();
		int x = sc.nextInt();
		int MEX = 0;
		int[] arr = new int[x];
		for(int q=0;q<Q;q++)
		{
			int in = sc.nextInt();
			arr[in%x]++;
			boolean add = true;
			int toprint = MEX;
			while(add)
			{
				if(arr[MEX%x] == 0)
					{
					add = false;
					break;
					}
				else
				{
					arr[MEX%x]--;
					MEX++;
					add = true;
				}
			}
			out.println(MEX);
			
		}
		out.flush();
		out.close();
		
	}
	
}