#include <bits/stdc++.h>
using namespace std;
int a[1000006];
int main() {
  int n, x;
  cin >> n >> x;
  int cnt = 1, ptr = 0;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a[t % x]++;
    while (a[ptr] == cnt) {
      ptr++;
      if (ptr == x) {
        cnt++;
        ptr = 0;
      }
    }
    cout << (cnt - 1) * x + ptr << endl;
  }
  return 0;
}
