#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 10;
const int inf = 0x3f3f3f3f;
bool mp[3000000];
long long vis[maxn];
int main() {
  long long q, x;
  scanf("%lld%lld", &q, &x);
  for (int i = 0; i < x; ++i) vis[i] = i;
  int ans = 0;
  while (q--) {
    long long v;
    scanf("%lld", &v);
    v = v % x;
    long long tmp = v;
    v = vis[v], vis[tmp] += x;
    if (v <= 2000000) mp[v] = 1;
    while (mp[ans]) ++ans;
    printf("%d\n", ans);
  }
  return 0;
}
