#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
std::string printVector(const std::vector<T> &data) {
  std::stringstream ss;
  std::ostream_iterator<T> out_it(ss, ", ");
  ss << "[";
  std::copy(data.begin(), data.end() - 1, out_it);
  ss << data.back() << "]";
  return ss.str();
}
template <typename T>
void print_array(const T &ary, int size) {
  for (int i = (0); i < (size); ++i) {
    cout << ary[i] << " ";
  }
  cout << endl;
}
const int mod = 1e9 + 7;
const long long LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
signed main(int argc, char const *argv[]) {
  printf("input\n");
  long long q, x;
  scanf("%lld", &q);
  scanf("%lld", &x);
  map<long long, vector<long long> > mp;
  map<long long, int> ex;
  long long ans = 0;
  for (int i = (0); i < (q); ++i) {
    long long y;
    scanf("%lld", &y);
    if (mp.find(y % x) == mp.end()) {
      mp[y % x].emplace_back(y % x);
      ex[y % x] = 1;
    } else {
      long long last = mp[y % x].back();
      mp[y % x].emplace_back(last + x);
      ex[last + x] = 1;
    }
    while (ex.find(ans) != ex.end()) {
      ans++;
    }
    printf("%lld\n", ans);
  }
}
