import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;

 
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]);
		HashMap<Integer, Integer> map = new HashMap<>();
		for(int i=0; i<x; i++) map.put(i, 0);
		for(int i=0; i<n; i++){
			int q = Integer.parseInt(br.readLine());
			map.put(q%x, map.get(q%x)+1);
			while(map.get(curMex%x)>=curMex/x+1 && curMex<i+1) curMex++;
			sb.append(curMex).append("\n");
		}
		System.out.print(sb);
	}
}