
import java.io.*;
import java.lang.*;
import java.math.BigInteger;
import java.util.*;

public class Main{
	static Scanner scanner=new Scanner(System.in);
	static BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args) throws IOException {
		String ss[]=bf.readLine().split(" ");
		int n=Integer.parseInt(ss[0]);
		int x=Integer.parseInt(ss[1]);
		int a[]=new int [x];
		StringBuilder sb=new StringBuilder();
		int ans=0;
		for(int i=0;i<n;i++) {
			int s=Integer.parseInt(bf.readLine());
			a[s%x]++;
			while(a[ans%x]>ans/x) ans++;
			sb.append(ans+"\n");
		}
		System.out.println(sb);
	}
}






