#include <bits/stdc++.h>
using namespace std;
mt19937_64 rang(
    chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
  uniform_int_distribution<int> uid(0, lim - 1);
  return uid(rang);
}
long long mpow(long long base, long long exp);
long long power(long long a, long long b);
const long long mod = 1000000007;
vector<int> g[300001];
int vis[300001];
long long res[300001];
long long sum[300001];
long long sz[300001];
struct segTree {
  int arr[400001];
  int res[1600003];
  int NO_OPERATION = 0;
  void init(int x, int lo, int hi) {
    if (lo == hi) {
      res[x] = arr[lo];
      return;
    }
    int mid = (lo + hi) / 2;
    init(2 * x, lo, mid);
    init(2 * x + 1, mid + 1, hi);
    update_point(x);
  }
  int get_sum(int x, int lo, int hi, int l, int r) {
    if (lo >= l && hi <= r) return res[x];
    if (lo > r || hi < l) return 0;
    int mid = (lo + hi) / 2;
    return get_sum(2 * x, lo, mid, l, r) +
           get_sum(2 * x + 1, mid + 1, hi, l, r);
  }
  void point_modify(int x, int lo, int hi, int pos, long long val) {
    if (lo == hi) {
      res[x] += val;
      return;
    }
    int mid = (lo + hi) / 2;
    if (pos <= mid)
      point_modify(2 * x, lo, mid, pos, val);
    else
      point_modify(2 * x + 1, mid + 1, hi, pos, val);
    update_point(x);
  }
  void update_point(int x) { res[x] = min(res[2 * x], res[2 * x + 1]); }
  long long point_query(int x, int lo, int hi, int val) {
    if (lo == hi) return lo;
    int mid = (lo + hi) / 2;
    int v1 = res[2 * x];
    if (v1 == val)
      return point_query(2 * x, lo, mid, val);
    else
      return point_query(2 * x + 1, mid + 1, hi, val);
  }
};
struct FenwickTree {
  int arr[100];
  int n;
  void update(int i, int delta) {
    while (i <= n) {
      arr[i] += delta;
      i = i + (i & (-i));
    }
  }
  int sum(int i) {
    if (i == 0) return 0;
    int res = 0;
    while (i > 0) {
      res = res + arr[i];
      i -= (i & (-i));
    }
    return res;
  }
};
void solve() {
  int q, x;
  cin >> q >> x;
  segTree st;
  for (int i = 1; i <= x; i++) st.arr[i] = 0;
  st.init(1, 1, x);
  while (q--) {
    int u;
    cin >> u;
    int y = u % x;
    st.point_modify(1, 1, x, y + 1, 1);
    int mn = st.res[1];
    int v = st.point_query(1, 1, x, mn);
    cout << mn * x + v - 1 << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  srand(chrono::high_resolution_clock::now().time_since_epoch().count());
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
long long mpow(long long base, long long exp) {
  base %= mod;
  long long result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((long long)result * base) % mod;
    base = ((long long)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b % 2 == 0) {
      b /= 2;
      a = a * a;
    } else {
      res = res * a;
      b--;
    }
  }
  return res;
}
