#include <bits/stdc++.h>
const int maxn = 2e6 + 5;
const int maxm = 1e5 + 10;
const int mod = 1e9 + 7;
const long long int INF = 1e18 + 100;
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
const double eps = 1e-6;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
inline long long int readll() {
  long long int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
long long int eular(long long int n) {
  long long int ans = n;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      ans -= ans / i;
      while (n % i == 0) n /= i;
    }
  }
  if (n > 1) ans -= ans / n;
  return ans;
}
long long int qpow(long long int a, long long int n) {
  long long int ans = 1;
  while (n) {
    if (n & 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    n >>= 1;
  }
  return ans;
}
long long int gcd(long long int a, long long int b) {
  return b > 0 ? gcd(b, a % b) : a;
}
using namespace std;
int a[maxn << 2];
void update(int rt, int l, int r, int s) {
  if (l == r) {
    a[rt]++;
    return;
  }
  int mid = l + r >> 1;
  if (s <= mid)
    update(rt << 1, l, mid, s);
  else
    update(rt << 1 | 1, mid + 1, r, s);
  a[rt] = min(a[rt << 1], a[rt << 1 | 1]);
}
int query(int rt, int l, int r, int sum) {
  if (l == r) return l;
  int mid = l + r >> 1;
  if (a[rt << 1] == sum)
    return query(rt << 1, l, mid, sum);
  else
    return query(rt << 1 | 1, mid + 1, r, sum);
}
int main() {
  int x, q;
  cin >> q >> x;
  while (q--) {
    int n;
    scanf("%d", &n);
    update(1, 1, x, n % x + 1);
    int ans = query(1, 1, x, a[1]);
    cout << a[1] * x + ans - 1 << "\n";
  }
}
