#include <bits/stdc++.h>
const int mod = 1e9 + 7;
const int maxn = 1e5;
using namespace std;
ifstream fi("");
ofstream fo("");
int q, x, y, cur;
int rem[4 * 100000];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> q >> x;
  cur = 0;
  for (int i = 0; i < q; i++) {
    cin >> y;
    rem[y % x]++;
    while (rem[cur % x] > 0) {
      rem[cur % x]--;
      cur++;
    }
    cout << cur << endl;
  }
}
