#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long maxn = 500005;
const long long mm = 1e+18;
long long power(long long x, long long y) {
  long long res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
void solve() {
  long long q, x;
  cin >> q >> x;
  int mx = 0;
  map<int, int> mp;
  while (q--) {
    int ok;
    cin >> ok;
    mp[(ok % x)]++;
    while (mp[(mx % x)]) {
      mp[(mx % x)]--;
      mx++;
    }
    cout << mx << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
