import java.util.*;
import java.io.*;
public class Main{
	
	 public static void main (String args[]){
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int t = sc.nextInt();
        int x = sc.nextInt();
        int arr[] = new int[x], min=1, min_index=-1, value=0, temp_min=Integer.MAX_VALUE;
        while(t-->0) {
        	int a = sc.nextInt() ;
        	arr[a%x]++;
        	
        	if(min_index==-1) {
        		for(int i=0; i<x; i++) {
	        		
	        		if(arr[i]<min) {
	        			min = arr[i];
	        			min_index=i;
	        			break;
	        		}
	        		if(min==0)
	        			break;
				}
        	}
        	else if((a%x)==min_index ) {
        		temp_min=++min;
	        	for(int i=min_index; i<x; i++) {
	        		
	        		if(arr[i]<min) {
	        			min = arr[i];
	        			min_index=i;
	        			break;
	        		}
	        		if(min==0)
	        			break;
	        	}
	        	if(temp_min==min) {
	        		for(int i=0; i<min_index; i++) {
		        		if(arr[i]==min) {
		        			min = arr[i];
		        			min_index=i;
		        			break;
		        		}
		        		if(min==0)
		        			break;
		        	}
	        	}
        	}
        	
        	value = min*x+min_index;
        	out.println(value);
        	
        	out.flush();
        }
    }
}
