#include <bits/stdc++.h>
using namespace std;
int main() {
  long long q, x;
  cin >> q >> x;
  long long in;
  set<long long> s;
  long long min = 0;
  while (q--) {
    cin >> in;
    if ((in - min) % x == 0) {
      s.insert(min);
      while (s.count(min)) {
        min++;
      }
      cout << min << endl;
    } else {
      if (in < min) {
        s.insert(x - (min - in) % x + min);
        cout << min << endl;
      } else {
        s.insert((in - min) % x + min);
        cout << min << endl;
      }
    }
  }
  return 0;
}
