#include <bits/stdc++.h>
using namespace std;
int coun[400001];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t, x;
  cin >> t >> x;
  int ans = 0;
  int lownu = 0;
  int now = 0;
  while (t--) {
    int q;
    cin >> q;
    int c = q % x;
    coun[c]++;
    bool flag = 1;
    while (flag) {
      if (coun[now] == lownu) {
        cout << now + lownu * x << "\n";
        break;
      } else {
        now++;
        if (now == x) {
          now = 0;
          lownu++;
        }
      }
    }
  }
  return 0;
}
