#include <bits/stdc++.h>
using namespace std;
int const N = 200001;
int t, x, c;
map<int, int> f, nxt;
int find(int u) { return !nxt[u] ? u : nxt[u] = find(nxt[u]); }
int main() {
  scanf("%d%d", &t, &x);
  int an = 0;
  while (t--) {
    scanf("%d", &c);
    long long a = (c % x) + (x * f[c % x]);
    ++f[c % x];
    nxt[find(a)] = find(a + 1);
    an = find(0);
    printf("%d\n", an);
  }
}
