#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> add_pair(pair<long long, long long> a,
                                    pair<long long, long long> b) {
  return make_pair(a.first + b.first, a.second + b.second);
}
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.first == b.first) return a.second > b.second;
  return a.first < b.first;
}
long long power(long long a, long long b) {
  long long res = 1;
  a = a % 1000000007;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % 1000000007;
      b--;
    }
    a = (a * a) % 1000000007;
    b = b >> 1;
  }
  return res;
}
long long fermat_inv(long long y) { return power(y, 1000000007 - 2); }
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
long long arr[100000];
void sieve() {
  long long i, j;
  for (i = 0; i < 100000; i += 1) arr[i] = 1;
  for (i = 2; i < 100000; i++) {
    if (arr[i] == 0) continue;
    for (j = i * i; j < 100000; j += i) {
      arr[j] = 0;
    }
  }
}
bool checkPrime(long long x) {
  long long i, cnt = 0;
  for (i = 2; i <= 1ll * sqrt(x); i++) {
    if (x % i == 0) cnt++;
    if (cnt > 0) return false;
  }
  return (cnt > 0);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long q, x, i, s, MEX;
  cin >> q >> x;
  vector<long long> ans(x);
  for (i = 0; i < x; i += 1) ans[i] = 0;
  MEX = 0;
  while (q--) {
    cin >> s;
    ans[s % x]++;
    for (i = (MEX % x); i < x; i += 1) {
      if (ans[i] == 0) break;
      ans[i]--;
      MEX++;
    }
    for (i = (MEX % x); i < x; i += 1) {
      if (ans[i] == 0) break;
      ans[i]--;
      MEX++;
    }
    cout << (MEX) << '\n';
  }
  return 0;
}
