
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 bfBufferedReader=new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args) throws IOException {
			String ss[]=bfBufferedReader.readLine().split(" ");
			int n=Integer.parseInt(ss[0]);
			int x=Integer.parseInt(ss[1]);
			StringBuilder sb=new StringBuilder();
			if(x==1) {
				for(int i=0;i<n;i++) {
					sb.append(i+"\n");
				}
				System.out.println(sb);
				return;
			}
			int ans=-1;
			PriorityQueue<Integer>pq=new PriorityQueue<Integer>((o1,o2)->o1-o2);
			
			for(int i=0;i<n;i++) {
				int a=Integer.parseInt(bfBufferedReader.readLine());
				//先把a变为距离ans小于x的数
				//ans是数组已知连续最大数
				if(a==ans)pq.add(x+a);
				else if(a>ans) {
					int s=a-ans;
					pq.add(a-s/x*x);//可能会等于
				}else {
					int s=ans-a;
					pq.add(s/x*x+a+x);
				}
				while(!pq.isEmpty()) {
					int d=pq.peek();
					if(d<=ans)pq.add(pq.poll()+x);
					else if(d==ans+1) {
						pq.poll();
						ans++;
					}else break;
				}
				sb.append(ans+1+"\n");
			}
			System.out.println(sb);
	}
}






