#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MOD2 = 998244353;
const long long N = 4e5 + 5;
const long double pi = 3.14159265359;
long long Q, x, y, cnt[N], mi, id, in[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> Q >> x;
  in[0] = x;
  while (Q--) {
    cin >> y;
    y %= x;
    in[cnt[y]]--;
    in[++cnt[y]]++;
    if (in[cnt[y] - 1] == 0 && cnt[y] - 1 == mi) mi++, id = 0;
    while (cnt[id] == mi + 1) id++;
    if (id == x) id = 0;
    cout << mi * x + id << "\n";
  }
  return 0;
}
