#include <bits/stdc++.h>
using namespace std;
int m[400000] = {0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int q, x;
  cin >> q >> x;
  long long int key = 0;
  while (q--) {
    long long int n;
    cin >> n;
    m[n % x]++;
    while (m[key % x] != 0) {
      m[key % x]--;
      key++;
    }
    cout << key << "\n";
  }
  return 0;
}
