#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int q, x;
  set<long long> s;
  cin >> q >> x;
  vector<int> l(x, 0);
  for (int i = 0; i < x; i++) {
    s.insert(i);
    l[i] = i;
  }
  while (q--) {
    long long n, i, val;
    cin >> n;
    i = n % x;
    val = l[i];
    s.erase(s.find(val));
    l[i] += x;
    s.insert(l[i]);
    cout << *s.begin() << endl;
  }
}
