import java.util.Scanner;

public class D {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int q = input.nextInt();
		int x = input.nextInt();
		int[] num = new int[x];
		if(x==1) {
			for(int i=0; i<q; i++) {
				int fake = input.nextInt();
			}
			System.out.println(q);
		}
		else {
			for(int i=0; i<q; i++) {
				int y = input.nextInt()%x;
				num[y]++;
				int min = Math.min(num[0], num[1]);
				min = Math.min(min, num[2]);
				if(min==0) {
					if(num[0]==0) {
						System.out.println(0);
					}
					else if(num[1]==0) {
						System.out.println(1);
					}
					else if(num[2]==0) {
						System.out.println(2);
					}
				}
				else {
					int min_num = -1;
					for(int j=x-1; j>=0; j--) {
						if(num[j]==min) {
							min_num = j;
							break;
						}
					}
					long ans = (long)x*(min-1)+min_num;
					min_num++;
					if(min_num%x==0) {
						min_num=0;
					}
					if(num[min_num]>min) {
						ans++;
					}
					min_num++;
					if(min_num%x==0) {
						min_num=0;
					}
					if(num[min_num]>min) {
						ans++;
					}
					System.out.println(ans+1);
				}
			}
		}
		input.close();
	}

}
