#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, x;
  cin >> q >> x;
  vector<int> arr(x, 0);
  int r = 0;
  for (int i = 0; i < q; i++) {
    int n;
    cin >> n;
    arr[n % x] += 1;
    while (arr[r % x] != 0) {
      arr[r % x] -= 1;
      r += 1;
    }
    cout << r << endl;
  }
}
