#include <bits/stdc++.h>
long long gcdfun(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcdfun(y, x % y);
}
long long diff(long long x, long long y) { return (long long)abs(x - y); }
using namespace std;
struct custom {
  bool operator()(pair<long long, long long> &p1,
                  pair<long long, long long> &p2) {
    return p1.second < p2.second;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q, x;
  cin >> q >> x;
  set<pair<long long, long long>> vals;
  vector<long long> mods(x, 0);
  for (int j = (int)0; j < int(x); j++) vals.insert({mods[j], j});
  for (int i = (int)0; i < int(q); i++) {
    int y;
    cin >> y;
    vals.erase({mods[y % x], y % x});
    mods[y % x]++;
    vals.insert({mods[y % x], y % x});
    cout << vals.begin()->first * x + vals.begin()->second << "\n";
  }
}
