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