#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 10;
int ans[N];
int main() {
  int q, x, res = 0;
  scanf("%d%d", &q, &x);
  while (q--) {
    int n;
    cin >> n;
    ans[n % x]++;
    while (ans[res % x] > 0) {
      ans[res % x]--;
      res++;
    }
    cout << res << endl;
  }
  return 0;
}
