import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class CF1294D {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String[] split = br.readLine().split(" ");
		int n = Integer.parseInt(split[0]);
		int curMex = 0;
		int x = Integer.parseInt(split[1]);
		int[] t = new int[x];
		for(int i=0; i<n; i++){
			int q = Integer.parseInt(br.readLine());
			t[q%x]++;
			while(t[curMex%x]>=curMex/x+1) curMex++;
			sb.append(curMex).append("\n");
		}
		System.out.print(sb);
	}
}