#include <bits/stdc++.h>
using namespace std;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
signed main() {
  long long q, x;
  cin >> q >> x;
  unordered_map<long long, long long> make_pair;
  long long mex = 0;
  long long n;
  while (q--) {
    cin >> n;
    long long flag = 1;
    make_pair[n % x]++;
    if (n == mex)
      mex++;
    else if (n % x == mex)
      mex++;
    while (flag) {
      flag = 0;
      if (make_pair[mex % x] > 1) {
        flag = 1;
        make_pair[mex % x]--;
        make_pair[mex]++;
        mex++;
      }
    }
    cout << mex << "\n";
  }
  return 0;
}
