#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e15;
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  long long n, x;
  cin >> n >> x;
  long long num = 0;
  vector<long long> cnt(x);
  for (long long i = 0; i < n; i++) {
    long long v;
    cin >> v;
    cnt[v % x]++;
    while (cnt[num % x]) {
      cnt[num % x]--;
      num++;
    }
    cout << num << endl;
  }
}
