#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, x, y;
  int a;
  scanf("%d%d", &q, &x);
  vector<int> m(x);
  set<pair<int, int> > b;
  for (int k = 0; k < x; k++) {
    b.insert(make_pair(m[k], k));
  }
  for (int i = 0; i < q; i++) {
    scanf("%d", &a);
    b.erase(make_pair(m[a % x], a % x));
    m[a % x]++;
    b.insert(make_pair(m[a % x], a % x));
    printf("%d\n", (b.begin()->first) * x + (b.begin()->second));
  }
}
