#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int q, x;
  cin >> q >> x;
  set<long long int> s;
  vector<long long int> v;
  long long int count = 0;
  long long int a, num, previous_size, after_size;
  for (long long int i = 0; i < q; i++) {
    cin >> a;
    num = (a + x) % x;
    previous_size = s.size();
    s.insert(num);
    after_size = s.size();
    if (previous_size == after_size) {
      v.push_back(num);
    }
    if (s.size() == x) {
      count++;
      s.clear();
      for (long long int i = 0; i < v.size(); i++) {
        previous_size = s.size();
        s.insert(v[i]);
        after_size = s.size();
        if (previous_size != after_size) v.erase(v.begin() + i);
      }
    }
    long long int extra = 0;
    set<long long int>::iterator it = s.begin();
    long long int p;
    long long int flag1 = 0;
    for (p = 0, it = s.begin(); p < x; it++, p++) {
      if (*it != p) {
        flag1 = 1;
        break;
      }
    }
    extra = p;
    cout << count * x + extra << endl;
  }
  return 0;
}
