#include <bits/stdc++.h>
using namespace std;
int main() {
  long long q, x;
  cin >> q >> x;
  long long n = q;
  long long a[n];
  map<long long, long long> m;
  long long min = 1;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    long long j = 0;
    while (m[(a[i] % x) + (j * x)] == 1) j++;
    m[(a[i] % x) + (j * x)]++;
    long long val = (a[i] % x) + (j * x);
    while (m[min] == 1) min++;
    cout << min << endl;
  }
  map<long long, long long>::iterator it;
}
