
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+1+"\n");
				}
				System.out.println(sb);
				return;
			}
			int ans=-1;
			TreeMap<Integer,Integer>pq=new TreeMap<Integer,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) {
					int b=x+a;
					if(pq.containsKey(b)) {
						pq.put(b, pq.get(b)+1);
					}else {
						pq.put(b, 1);
					}
				}
				else if(a>ans) {
					int s=a-ans;
					int b=a-s/x*x;
					if(pq.containsKey(b)) {
						pq.put(b, pq.get(b)+1);
					}else {
						pq.put(b, 1);
					}
				}else {
					int s=ans-a;
					int b=s/x*x+a+x;
					if(pq.containsKey(b)) {
						pq.put(b, pq.get(b)+1);
					}else {
						pq.put(b, 1);
					}
				}
				
				while(!pq.isEmpty()) {
					//System.out.println("ppp=");
					int d=pq.firstKey();
					if(d<=ans) {
						int c=pq.get(d);
						int b=pq.remove(d);
						pq.put(d+x, c);
					}
					else if(d==ans+1) {
						int c=pq.get(d);
						int b=pq.remove(d);
						if(c-1>0)pq.put(d+x, c-1);
						ans++;
					}else break;
				}
				sb.append(ans+1+"\n");
			}
			System.out.println(sb);
	}
	static class Node{
		int x,num;
		public Node(int x, int num) {
			this.x = x;
			this.num = num;
		}
	}
}






