#include <bits/stdc++.h>
int q, x, l, r, n, ans = 0, i = 0;
int check[31250005];
int bsearch(int l, int r, int rem, int ret) {
  if (l > r) return ret;
  int mid = (l + r) >> 1;
  int number = rem + x * mid;
  if (!(check[number / 32] & (1 << (number % 32)))) {
    ret = number;
    return bsearch(l, mid - 1, rem, ret);
  } else
    return bsearch(mid + 1, r, rem, ret);
}
int main() {
  scanf("%d", &q), scanf("%d", &x);
  l = 0;
  r = 1000000000 / x;
  while (q--) {
    scanf("%d", &n);
    n = bsearch(l, r, n % x, n);
    check[n / 32] |= (1 << (n % 32));
    while (i < 31250001) {
      if (check[i] < 2147483647) {
        for (int j = 0; j < 32; j++) {
          if (!(check[i] & (1 << j))) {
            ans = 32 * i + j;
            break;
          }
        }
        break;
      }
      ++i;
    }
    printf("%d", ans);
    printf("\n");
  }
  return 0;
}
