#include <bits/stdc++.h>
using namespace std;
long long q, x, a[400005], lua[400005], leaf[400005 * 8];
pair<long long, long long> IT[400005 * 8];
pair<long long, long long> mer(pair<long long, long long> l,
                               pair<long long, long long> r) {
  if (l.first < r.first) return l;
  if (r.first < l.first)
    return r;
  else
    return {l.first, min(r.second, l.second)};
}
void buildIT(long long i, long long l, long long r) {
  if (l == r) {
    leaf[l] = i;
    IT[i].second = l;
    return;
  }
  long long mid = (l + r) / 2;
  buildIT(i * 2, l, mid);
  buildIT(i * 2 + 1, mid + 1, r);
  IT[i] = mer(IT[i * 2], IT[i * 2 + 1]);
}
void update(long long x) {
  long long i = leaf[x];
  IT[i].first++;
  while (i > 0) {
    i /= 2;
    IT[i] = mer(IT[i * 2], IT[i * 2 + 1]);
  }
}
pair<long long, long long> get(long long i, long long l, long long r,
                               long long u, long long v) {
  if (r < u || l > v) return pair<long long, long long>{1e9, 1e9};
  if (l >= u && r <= v) return IT[i];
  long long mid = (l + r) / 2;
  return mer(get(i * 2, l, mid, u, v), get(i * 2 + 1, mid + 1, r, u, v));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> q >> x;
  buildIT(1, 0, x - 1);
  for (int i = 1; i <= q; i++) cin >> a[i];
  for (int i = 1; i <= q; i++) {
    long long t = a[i] % x;
    update(t);
    pair<long long, long long> X = get(1, 0, x - 1, 0, x - 1);
    cout << x * X.first + X.second << "\n";
  }
  return 0;
}
