#include <bits/stdc++.h>
using namespace std;
int m[400005];
int main() {
  int q, x;
  scanf("%d%d", &q, &x);
  int mex = 0;
  while (q--) {
    int n;
    cin >> n;
    int rem = n % x;
    m[rem]++;
    while (m[mex % x]) {
      m[mex % x]--;
      mex++;
    }
    printf("%d\n", mex);
  }
}
