#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long INF = 0x3f3f3f3f;
const long double EPS = 1e-6;
const long long N = 400040;
long long n, x;
long long a[N], c[N];
signed main() {
  cin >> n >> x;
  long long last = -1, ans = -1;
  bool flag = 0;
  for (long long(i) = 0; (i) < (long long)n; (i)++) {
    long long b;
    cin >> b;
    a[b % x]++;
    c[b % x]++;
    if (b % x == last) flag = 0;
    a[i % x]--;
    if (a[i % x] < 0) {
      last = i % x;
      flag = 1;
    }
    if (!flag)
      cout << i + 1 << endl;
    else
      cout << min(x * c[last] + last, i + 1) << endl;
  }
  return 0;
}
