#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << ' ' << *it << " = " << a;
  err(++it, args...);
}
const long long MOD = 1e9 + 7;
const int N = 1e6 + 9, M = (1 << 31), OO = 0x3f3f3f3f;
int arr[N], cur;
int main() {
  int n, x;
  scanf("%d%d", &n, &x);
  for (int i = 0; i < n; ++i) {
    int y;
    scanf("%d", &y);
    y %= x;
    arr[y]++;
    while (arr[cur % x]) arr[cur % x]--, ++cur;
    printf("%d\n", cur);
  }
  return 0;
}
