#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 10;
int a[N];
int ans = 0;
int main() {
  int q, x;
  cin >> q >> x;
  while (q--) {
    int n;
    cin >> n;
    a[n % x]++;
    while (a[ans % x]) {
      a[ans % x]--;
      ans++;
    }
    cout << ans << endl;
  }
  return 0;
}
