#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 56;
int q, x;
int br[5 * N];
void build(int i, int j, int node) {
  if (i == j) {
    br[node] = -x + i;
    return;
  }
  int mid = i + (j - i) / 2;
  build(i, mid, 2 * node);
  build(mid + 1, j, 2 * node + 1);
  br[node] = min(br[2 * node], br[2 * node + 1]);
}
void update(int i, int j, int pos, int node) {
  if (i == j) {
    br[node] += x;
    return;
  }
  int mid = i + (j - i) / 2;
  if (pos <= mid) {
    update(i, mid, pos, 2 * node);
  } else {
    update(mid + 1, j, pos, 2 * node + 1);
  }
  br[node] = min(br[2 * node], br[2 * node + 1]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> q >> x;
  build(0, x - 1, 1);
  vector<int> ans;
  for (int i = 1; i <= q; i++) {
    int y;
    cin >> y;
    update(0, x - 1, y % x, 1);
    ans.push_back(br[1] + x);
  }
  for (auto f : ans) {
    cout << f << endl;
  }
}
