#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, i, j, k, l, m, b, t, sum, sum1, flag, max1, min1;
  cin >> n >> k;
  max1 = 0;
  vector<long long> v(k, 0);
  for (i = 1; i <= n; i++) {
    cin >> m;
    m %= k;
    v[m]++;
    while (v[max1 % k] != 0) {
      v[max1 % k]--;
      max1++;
    }
    cout << max1 << endl;
  }
}
