#include <bits/stdc++.h>
using namespace std;
long long int fx[] = {1, 0, -1, 0, -1, -1, 1, 1};
long long int fy[] = {0, 1, 0, -1, -1, 1, -1, 1};
int main() {
  long long int q, x, num, min = 0, n;
  cin >> q >> x;
  map<long long int, long long int> mp, mp1;
  while (q--) {
    cin >> n;
    if (n > min) {
      num = n - min;
      if (num % x == 0) {
        mp[min] = 1;
        mp1[min]++;
      } else {
        long long int num1 = n - ((long long int)(num / x) * x);
        mp[num1 + (mp1[num1] * x)] = 1;
        mp1[num1 + (mp1[num1] * x)]++;
      }
    } else if (n < min) {
      num = min - n;
      if (num % x == 0) {
        mp[min] = 1;
        mp1[min]++;
      } else {
        num = ceil((double)num / (double)x);
        mp[n + (num * x)] = 1;
        mp1[n + (num * x)]++;
      }
    } else {
      mp[n] = 1;
      mp1[n]++;
    }
    while (mp[min] == 1) min++;
    cout << min << "\n";
  }
  return 0;
}
