#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<fstream>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x3f3f3f3f
using namespace std;

int a[800005];

int main()
{
	int m, x, z = 0;
	scanf_s("%d%d", &m, &x);
	for (int i = 1; i <= m; i++)
	{
		int y;
		scanf_s("%d", &y);
		y = y % x;
		a[y]++;
		if (a[z] > 0) z++;
		else if (z >= x)
		{
			if (a[z - x] > 1) a[z] = a[z - x] - 1, a[z - x] = 1, z++;
		}
		printf("%d\n", z);
	}
	return 0;
}