#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long q, x;
  cin >> q >> x;
  long long mn = 0;
  unordered_map<long long, long long> m;
  while (q--) {
    long long num;
    cin >> num;
    if (num == mn) {
      mn++;
      m[num]++;
      while (m.count(mn) > 0) {
        mn++;
      }
      cout << mn << "\n";
    } else {
      if (num < mn) {
        long long low = 1;
        long long high = 10000000000;
        long long k;
        while (low <= high) {
          k = (low + high) / 2;
          if (num + (k * x) <= mn && m.count(num + (k * x)) <= 1) {
            low = k + 1;
          } else {
            high = k - 1;
          }
        }
        num += (high * x);
        if (num == mn) {
          if (m.count(num) == 0) {
            mn++;
            m[num]++;
            while (m.count(mn) > 0) {
              mn++;
            }
            cout << mn << "\n";
          } else {
            while (m.count(num) > 0) {
              num += x;
            }
            while (m.count(mn) > 0) {
              mn++;
            }
            m[num]++;
            cout << mn << "\n";
          }
        } else {
          num += x;
          m[num]++;
          cout << mn << "\n";
        }
      } else {
        long long low = 1;
        long long high = 10000000000;
        long long k;
        while (low <= high) {
          k = (low + high) / 2;
          if (num - (k * x) >= mn && m.count(num - (k * x)) <= 1) {
            low = k + 1;
          } else {
            high = k - 1;
          }
        }
        num -= (high * x);
        if (num < 0) {
          long long f = (-num) / x;
          num += (f * x);
          if (num < 0) {
            num += x;
          }
        }
        if (num == mn) {
          if (m.count(num) == 0) {
            mn++;
            m[num]++;
            while (m.count(mn) > 0) {
              mn++;
            }
            cout << mn << "\n";
          } else {
            if (m.count(num) > 0) {
              num += x;
            }
            while (m.count(mn) > 0) {
              mn++;
            }
            m[num]++;
            cout << mn << "\n";
          }
        } else {
          if (m.count(num) > 0) {
            num += x;
          }
          m[num]++;
          cout << mn << "\n";
        }
      }
    }
  }
}
