import java.util.*;
public class D {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
			int q = sc.nextInt();
			int x = sc.nextInt();
			
			int[] cnt = new int[x];
			int mex = 0;
			StringBuilder ans = new StringBuilder();
			for(int i=0;i<q;i++) {
				int y = sc.nextInt();
				cnt[y%x]++;
				
				while(cnt[mex%x]!=0) {
					cnt[mex%x]--;
					mex++;
				}
				ans.append(mex+"\n");
			}
			System.out.print(ans);

	}

}
