#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int MAXN = (int)1e6;
const int MOD = (int)1e9 + 7;
const int INF = 0x3f3f3f3f;
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
int a[400000];
int main() {
  int q, x, t;
  int m;
  memset(a, 0, sizeof(a));
  cin >> q >> x;
  m = 0;
  while (q--) {
    cin >> t;
    a[t % x]++;
    while (a[m % x]) {
      a[m % x]--;
      m++;
    }
    cout << m << endl;
  }
  return 0;
}
