import java.util.*;
import java.io.*;
public class MEX {
	public static void main(String[] args) throws IOException{
		BufferedReader x = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer e = new StringTokenizer(x.readLine());
		int q = Integer.parseInt(e.nextToken());
		int t =  Integer.parseInt(e.nextToken());
		minSegTree tree = new minSegTree(t);
		tree.construct(0, t - 1, 0);
		for(int i = 0; i < q; i++) {
			e = new StringTokenizer(x.readLine());
			int a = Integer.parseInt(e.nextToken());
			int mod = a - a/t;
			tree.update(1, mod, 0, t-1, 0);
			int firstIndex = tree.query(0, t-1, 0, t-1, 0);
			System.out.println(tree.values[firstIndex] * t + firstIndex);
		}
	}
	
}


class minSegTree{
	private int n;
	public minSegTree (int n) {
		this.n = n;
		st = new int[n * 4 + 1];
		values = new int[n];
	}
	public int[] st;
	public int[] values;
	public void update(int val, int point, int j, int k, int node) {
		if (k < point || j > point) return;
		if (j == point && k == point) {
			values[j] += val;
			st[node] = j;
			return;
		}
		int midpt = (j + k) / 2;
		update(val, point, j, midpt, 2 * node + 1);
		update(val, point, midpt + 1, k, 2 * node + 2);
		st[node] = values[st[2 * node + 1]] > values[st[2 * node + 2]] ? st[2 * node + 2]:st[2 * node + 1];
	}

	public int query(int low, int high, int j, int k, int node) {
		if (j > high || k < low) return -1;
		if (j >= low && k <= high) return st[node];
		int midpt = (j + k) / 2;
		int firstSide = query(low, high, j, midpt, 2 * node + 1);
		int secondSide = query(low, high, midpt + 1, k, 2 * node + 2);
		int firstVal = firstSide >= 0 ? values[firstSide]:Integer.MAX_VALUE;
		int secondVal = secondSide >= 0 ? values[secondSide]:Integer.MAX_VALUE;
		return firstVal > secondVal ? secondSide: firstSide;
	}
	
	public void construct(int j, int k, int node) {
		if (j == k) {
			st[node] = j;
			return;
		}
		int midpt = (j + k) / 2;
		construct(j, midpt, 2 * node + 1);
		construct(midpt + 1, k, 2 * node + 2);
		st[node] = values[st[2 * node + 1]] > values[st[2 * node + 2]] ? st[2 * node + 2]:st[2 * node + 1];
	}


	
}