#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[400000] = {};
  int n, x;
  cin >> n >> x;
  int amSeries = 0;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    arr[num % x]++;
    int min = arr[0];
    int offset = 0;
    for (int k = 0; k < x; k++) {
      if (arr[k] <= min) {
        min = arr[k];
        offset = k;
        if (min == amSeries) break;
      }
    }
    if (min != amSeries) amSeries++;
    cout << amSeries * x + offset << endl;
  }
}
