import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn= new Scanner(System.in);
		int n = scn.nextInt();
		int x= scn.nextInt();
		HashMap<Integer,Integer> hm = new HashMap<>();
		PriorityQueue<pair> pq = new PriorityQueue<>();
	  
	      pq.add(new pair(0,0));
	      hm.put(0,0);
	     int  i=1;
	     while(i%x!=0){
	    	 hm.put(i,0);
	    	 pq.add(new pair(i,0));
	    	 i++;
	     }
	     if(x==1){
	    	 i=1;
	    	 while(n-->0){
	    		 int val = scn.nextInt();
	    	 System.out.print(i);
	    	 i++;
	    	 
	    	 }
	     }else{
		while(n-->0){
			int  val = scn.nextInt();
			val=val%x;
			if(hm.containsKey(val)){
				hm.put(val, hm.get(val)+1);
				pq.add(new pair(val,hm.get(val)));
			}else{
				hm.put(val, 1);
				pq.add(new pair(val,1));
			}
			res(hm,pq,x);
		}
	     }

	}
	public static void res(HashMap<Integer,Integer> hm , PriorityQueue<pair> pq, int x){
		pair p = pq.peek();
		while(pq.size()>0 &&p.count!=hm.get(p.val)){
		     pq.remove();
		     if(pq.size()>0){
		     p=pq.peek();
		     }
		}
		System.out.println((p.count*x+p.val));
		
	}
	
	public  static class pair implements Comparable<pair>{
		int val ;
		int count;
		public pair(int val ,int count){
			this.val=val;
			this.count=count;
			
		}
		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
		if(this.count == o.count){
			return this.val-o.val;
		}else{
			return this.count-o.count;
		}
		}
	}

}