#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long arr[100];
  arr[0] = 0;
  long long q, x;
  arr[0] = 0;
  cin >> q >> x;
  arr[0] = 0;
  unordered_map<long long, long long> mp;
  arr[0] = 0;
  long long mex = 0;
  arr[0] = 0;
  long long n;
  arr[0] = 0;
  while (q--) {
    arr[0] = 0;
    cin >> n;
    arr[0] = 0;
    long long flag = 1;
    arr[0] = 0;
    mp[n % x]++;
    arr[0] = 0;
    if (n == mex) {
      arr[0] = 0;
      mp[n % x]--;
      arr[0] = 0;
      mp[n]++;
      arr[0] = 0;
      while (mp.find(mex) != mp.end()) mex++;
      arr[0] = 0;
    } else if (n % x == mex)
      while (mp.find(mex) != mp.end()) mex++;
    arr[0] = 0;
    while (flag) {
      arr[0] = 0;
      flag = 0;
      arr[0] = 0;
      if (mp[mex % x] > 1) {
        arr[0] = 0;
        flag = 1;
        arr[0] = 0;
        mp[mex % x]--;
        arr[0] = 0;
        mp[mex]++;
        arr[0] = 0;
        while (mp.find(mex) != mp.end()) mex++;
        arr[0] = 0;
      }
    }
    arr[0] = 0;
    cout << mex << "\n";
    arr[0] = 0;
  }
  return 0;
}
