#include <bits/stdc++.h>
using namespace std;
const long long int MAX = 4e5 + 5;
const long long int MAX1 = 1e2 + 5;
const long long int INF = 1e15 + 2;
const long long int MOD = 1e9 + 7;
inline long long int nc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long int read() {
  long long int ret = 0;
  bool f = 0;
  char ch = nc();
  while (ch > '9' || ch < '0') f ^= ch == '-', ch = nc();
  while (ch <= '9' && ch >= '0') ret = ret * 10 + ch - '0', ch = nc();
  return f ? -ret : ret;
}
long long int power(long long int base, long long int ind, long long int mod) {
  long long int res = 1;
  while (ind) {
    if (ind & 1) res = (res * base) % mod;
    base = (base * base) % mod;
    ind >>= 1;
  }
  return res;
}
long long int inv(long long int den, long long int mod) {
  return power(den, mod - 2, mod);
}
long long int f[MAX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  ;
  long long int q, x;
  cin >> q >> x;
  long long int ans = 0;
  while (q--) {
    long long int val;
    cin >> val;
    f[val % x]++;
    while (f[ans % x]) {
      f[ans % x]--;
      ans++;
    }
    cout << ans << "\n";
  }
}
