#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, x;
  cin >> q >> x;
  int arr[x];
  int repsDone = 0;
  for (int i = 0; i < x; i++) arr[i] = 0;
  int alreadyDone = 0;
  while (q--) {
    int temp;
    cin >> temp;
    arr[temp % x]++;
    while (1) {
      if (arr[alreadyDone] <= repsDone) {
        cout << arr[alreadyDone] * x + alreadyDone << endl;
        break;
      } else {
        if (alreadyDone == x - 1) repsDone++;
        alreadyDone = (alreadyDone + 1) % x;
      }
    }
  }
  return 0;
}
