#include <bits/stdc++.h>
using namespace std;
int a[400010], n, x;
int main() {
  scanf("%d%d", &n, &x);
  while (n--) {
    int num, minn, pos;
    scanf("%d", &num);
    a[num % x]++;
    minn = a[0];
    pos = 0;
    for (int i = 1; i <= x - 1; i++) {
      if (a[i] < minn) {
        pos = i;
        break;
      }
    }
    printf("%d\n", a[pos] * x + pos);
  }
  return 0;
}
