import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;
public class D615 {

	public static void main(String[] args) {
		FastScanner in = new FastScanner(System.in);
		int Q = in.nextInt();
		int X = in.nextInt();
		int[] arr = new int[Q];
		for(int i = 0; i < Q; i++) {
			arr[i] = in.nextInt() % X;
		}
		
		StringBuilder sb = new StringBuilder();
		
		SegTree st = new SegTree(X);
		
		for(int i = 0; i < Q; i++) {
			int val = arr[i];
			
			st.increment(val);
			
			Node n = st.getMin();
			long ans = X * n.count + n.residue;
			sb.append(ans);
			sb.append("\n");
		}
		
		System.out.println(sb);
	}
	
	public static class SegTree {
		int N;
		Node[] arr;
		
		public SegTree(int X) {
			N = X;
			arr = new Node[N << 1];
			
			for(int i = 0; i < N; i++)
				arr[i+N] = new Node(i, 0);
			for(int i = N-1; i > 0; i--) {
				Node left = arr[i << 1];
				Node right = arr[i << 1 | 1];
				
				//System.out.println("indices = " + (i << 1) + " " + (i << 1 | 1));
				//System.out.println("left, right = " + left + " " +right);
				
				if(left.count == right.count) {
					arr[i] = new Node(Math.min(left.residue, right.residue), left.count);
				}
				else if(left.count < right.count){
					arr[i] = new Node(left);
				}
				else {
					arr[i] = new Node(right);
				}
			}
		}
		
		public void increment(int pos) {
			pos += N;
			arr[pos].count++;
			for(; pos > 1; pos >>= 1) {
				//Node parent = arr[pos >> 1];
				
				Node curr = arr[pos];
				Node next = arr[pos ^ 1];
				
				if(curr.count == next.count) {
					arr[pos >> 1] = new Node(Math.min(curr.residue, next.residue), curr.count);
				}
				else if(curr.count < next.count) {
					arr[pos >> 1] = new Node(curr);
				}
				else {
					arr[pos >> 1] = new Node(next);
				}
			}
		}
		
		public Node getMin() {
			return arr[1];
		}
	}
	
	public static class Node implements Comparable<Node> {
		int residue;
		int count;
		
		public Node(int residue, int count) {
			this.residue = residue;
			this.count = count;
		}
		
		public Node(Node n) {
			this.residue = n.residue;
			this.count = n.count;
		}
		
		public int compareTo(Node n) {
			if(count == n.count) {
				return residue - n.residue;
			}
			return count - n.count;
		}
		
		public boolean equals(Object o) {
			if(!(o instanceof Node)) return false;
			return residue == ((Node) o).residue;
		}
		
		public String toString() {
			return "(" + residue + ", " + count + ")";
		}
	}
	
	/**
	 * Source: Matt Fontaine
	 */
	static class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int chars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
		}

		int read() {
			if (chars == -1)
				throw new InputMismatchException();
			if (curChar >= chars) {
				curChar = 0;
				try {
					chars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (chars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}

}
/*
7 3
0
1
2
2
0
0
10
outputCopy
1
2
3
3
4
4
7
inputCopy
4 3
1
2
1
2
outputCopy
0
0
0
0
*/