#include <bits/stdc++.h>
using namespace std;
int q, x, ans;
int a[400005];
int main() {
  while (cin >> q >> x) {
    map<int, int> m;
    while (q--) {
      int k;
      cin >> k;
      a[k % x]++;
      while (a[ans % x]) {
        a[ans % x]--;
        ans++;
      }
      cout << ans << endl;
    }
  }
}
