
import java.util.*;

import java.io.*;

public class vc2 {

	public static void main(String[] args) throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine();
		StringTokenizer st=new StringTokenizer(s);
		int q=Integer.parseInt(st.nextToken());
		int x=Integer.parseInt(st.nextToken());
		int Q=q;
//		HashSet<Integer>set=new HashSet();
		int[]arr=new int[x];
		int[]dp=new int[Q+2];
		Arrays.fill(arr, -1);
		int curr=0;
		
		while(q-- !=0) {
			s=br.readLine();
			int p=Integer.parseInt(s);;
			int idx=p%x;
			
			if(arr[idx]==-1) {
				arr[idx]=idx;
				if(idx<dp.length)
				dp[idx]++;
			}else {
				int a=arr[idx]+x;
				if(a>0)
					arr[idx]=a;
				if(arr[idx]<dp.length)
				dp[arr[idx]]++;
			}
			
			if(dp[curr]==0)
				System.out.println(curr);
			else {
				
				for(int i=curr+1;i<=Q+1;i++) {
					if(dp[i]==0) {
						System.out.println(i);
						curr=i;
						break;
					}
				}

			}
		}
	}

}
