#include <bits/stdc++.h>
using namespace std;
const long long N = 400005;
long long a[N];
pair<long long, long long> tree[4 * N + 5];
long long q, x;
void build(long long node, long long l, long long r) {
  if (l == r) {
    tree[node].first = l;
    return;
  }
  long long m = (l + r) / 2;
  build(2 * node, l, m);
  build(2 * node + 1, m + 1, r);
}
void update(long long node, long long l, long long r, long long index,
            long long val) {
  if (l == r) {
    tree[node].second = val;
    return;
  }
  long long m = (l + r) / 2;
  if (index <= m) {
    update(2 * node, l, m, index, val);
  } else {
    update(2 * node + 1, m + 1, r, index, val);
  }
  if (tree[2 * node].second < tree[2 * node + 1].second) {
    tree[node].first = tree[2 * node].first;
    tree[node].second = tree[2 * node].second;
  } else if (tree[2 * node].second > tree[2 * node + 1].second) {
    tree[node].first = tree[2 * node + 1].first;
    tree[node].second = tree[2 * node + 1].second;
  } else {
    tree[node].second = tree[2 * node].second;
    tree[node].first = min(tree[2 * node].first, tree[2 * node + 1].first);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> q >> x;
  build(1, 0, x - 1);
  while (q--) {
    long long val;
    cin >> val;
    val %= x;
    a[val]++;
    update(1, 0, x - 1, val, a[val]);
    cout << x * tree[1].second + tree[1].first << "\n";
  }
}
