#include <bits/stdc++.h>
using namespace std;
long long t, k, n, m, a, b, ans, sum, total, count1, count2, hell = 1000000007;
long long parent[500001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  srand(chrono::high_resolution_clock::now().time_since_epoch().count());
  cout << std::setprecision(11) << std::fixed;
  long long x;
  cin >> t >> x;
  vector<long long> v(x, 0);
  vector<long long> ar(400001, 0);
  while (t > 0) {
    cin >> a;
    a = a % x;
    v[a] += 1;
    if ((v[a] - 1) * x + a < 400001) ar[(v[a] - 1) * x + a] = 1;
    for (int i = b; i < 400001; i++) {
      if (ar[i] == 0) {
        cout << i << endl;
        b = i;
        break;
      }
    }
    t--;
  }
  return 0;
}
