
import java.util.*;

public class test {
	static int N = (int) 2e5 + 99;

	public static class pair implements Comparable<pair> {
		int x;
		int s;

		public pair(int x, int s) {
			this.x = x;
			this.s = s;
		}

		@Override
		public int compareTo(pair o) {
			return (this.s - o.s);
		}
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		int x=sc.nextInt();
		StringBuilder st = new StringBuilder();
		HashMap<Integer,Integer>hm=new HashMap<>();
		int i=0;
		while (t-- > 0) {
		int y=sc.nextInt();
		hm.put(y%x, hm.getOrDefault(y%x, 0)+1);
		while(hm.containsKey(i%x)) {
			if(hm.containsKey(i))i++;
			else {
				if(hm.get(i%x)>1) {
					hm.put(i%x, hm.get(i%x)-1);
					i++;
				}
				else break;
				
			}
			
		}
		
			st.append(i +"\n");
		}
		
		System.out.println(st);
		

	}

	}
