#include <bits/stdc++.h>
using namespace std;
map<long long int, long long int> prime(long long int x, long long int *count) {
  map<long long int, long long int> mp;
  while (x % 2 == 0) {
    x /= 2;
    (*count)++;
    mp[2]++;
  }
  for (long long int i = 3; i <= sqrt(x); i = i + 2) {
    while (x % i == 0) {
      x /= i;
      mp[i]++;
      (*count)++;
    }
  }
  if (x > 2) {
    (*count)++;
    mp[x]++;
  }
  return mp;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int times, x;
  cin >> times >> x;
  map<int, int> mp;
  int ans = 0;
  while (times--) {
    int w;
    cin >> w;
    mp[w % x]++;
    if (mp.find(ans % x) != mp.end()) {
      int k = 0;
      int tmp = ans % x - 1;
      for (auto it = mp.find(ans % x); it != mp.end() && tmp == ans % x - 1;) {
        if (it->first % x == tmp + 1) {
          if (it->second == 1) {
            int t = it->first;
            it++;
            ans++;
            mp.erase(t);
            tmp++;
          } else {
            tmp++;
            it->second--;
            ans++;
            it++;
          }
        } else {
          k = 1;
          break;
        }
      }
      if (k == 0) {
        tmp = -1;
        for (auto it = mp.begin(); it != mp.end();) {
          if (it->first % x == tmp + 1) {
            if (it->second == 1) {
              int tu = it->first;
              it++;
              ans++;
              mp.erase(tu);
              tmp++;
            } else {
              it->second--;
              ans++;
              it++;
              tmp++;
            }
          } else {
            k = 1;
            break;
          }
        }
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
