#include <bits/stdc++.h>
using namespace std;
long long mod = 10e8 + 7;
long long i, j;
int main() {
  long long q, x;
  cin >> q >> x;
  long long y;
  map<long long, long long> m;
  while (q--) {
    cin >> y;
    y %= x;
    m[y]++;
    long long pos, count = INT_MAX;
    for (i = 0; i < x; i++) {
      if (m.find(i) == m.end()) {
        pos = i;
        break;
      }
      if (m[i] < count) {
        pos = i;
        count = m[i];
      }
    }
    cout << (x * m[pos]) + (pos % x) << endl;
  }
  return 0;
}
