import java.util.*;
import java.io.*;
public class Main {
      static class pair implements Comparable<pair>{
        int a;
        int b;
        public pair(int a, int b){
            this.a=a;
            this.b=b;
        }
        public int compareTo(pair p){
            return (a-p.a==0)?b-p.b:a-p.a;
        }
          
      }
  public static void main(String[] args) throws IOException,InterruptedException{
	BufferedReader	 br = new BufferedReader(new InputStreamReader(System.in));
	PrintWriter out = new PrintWriter(System.out);
     	// String s = br.readLine();
        // char[] arr=s.toCharArray();
        // ArrayList<Integer> arrl = new ArrayList<Integer>(); 
        // TreeSet<Integer> ts1 = new TreeSet<Integer>(); 
        // HashSet<Integer> h = new HashSet<Integer>(); 
        // HashMap<Integer, Integer> map= new HashMap<>(); 
        // PriorityQueue<String> pQueue = new PriorityQueue<String>(); 
        // LinkedList<String> object = new LinkedList<String>(); 
        // StringBuilder str = new StringBuilder(); 
        //*******************************************************//
 	   //  StringTokenizer   st = new StringTokenizer(br.readLine());
 	   // 	  int t = Integer.parseInt(st.nextToken());
 	   //    while(t-->0){
 	   //        st = new StringTokenizer(br.readLine());
 	   // 	  int n = Integer.parseInt(st.nextToken());
 	   // 	  int[] arr = new int[n];
 	   // 	  st = new StringTokenizer(br.readLine());
 	   // 	  for(int i=0; i<n; i++){
 	   // 	      arr[i] =Integer.parseInt(st.nextToken());
 	   // 	  }
 	   // 	  int ans =0;
 	   // 	  out.println(ans);
 	   //    }
 	         
 	           StringTokenizer   st = new StringTokenizer(br.readLine());
 	    	  int t = Integer.parseInt(st.nextToken());
 	    	  int x = Integer.parseInt(st.nextToken());
 	    	  int ans =0;
 	    	  TreeSet<Integer> ts = new TreeSet<Integer>();
 	      loop: while(t-->0){
 	      st = new StringTokenizer(br.readLine());
 	     int n = Integer.parseInt(st.nextToken());
 	       if(n>=ans){int tmp = (n-ans)/x;
 	       n-= tmp*x;}
 	       else {
 	           int tmp = (ans-n)/x+((ans-n)%x==0?0:1);
 	           n+=tmp*x;
 	       }
 	       ts.add(n);
 	       while(ts.contains(ans)) ans++;
 	       out.println(ans);
 	      }
 	         
 	   	  out.flush();
 	      }
      static int findFirstMissing(int array[], int start, int end)  
    { 
        if (start > end) 
            return end + 1; 
  
        if (start != array[start]) 
            return start; 
  
        int mid = (start + end) / 2; 
  
        // Left half has all elements from 0 to mid 
        if (array[mid] == mid) 
            return findFirstMissing(array, mid+1, end); 
  
        return findFirstMissing(array, start, mid); 
    } 
}