#include <bits/stdc++.h>
using namespace std;
int main() {
  long long q, x;
  cin >> q >> x;
  long long arr[x];
  memset(arr, 0, sizeof(arr));
  set<pair<long long, long long> > s;
  for (long long i = 0; i < x; i++) {
    s.insert({arr[i], i});
  }
  while (q--) {
    int n;
    cin >> n;
    n = n % x;
    s.erase({arr[n], n});
    arr[n] += 1;
    s.insert({arr[n], n});
    cout << s.begin()->first * x + s.begin()->second << endl;
  }
}
