#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int primeFactors(int n) {
  int count = 0;
  while (n % 2 == 0) {
    count++;
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      count++;
      n = n / i;
    }
  }
  if (n > 2) count++;
  return count;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  while (t--) {
    int q, x;
    cin >> q >> x;
    vector<int> rem(x + 1);
    int answer = 0;
    for (int i = 0; i < q; i++) {
      int num;
      cin >> num;
      rem[num % x]++;
      while (rem[(answer) % x] != 0) {
        rem[(answer) % x]--;
        answer++;
      }
      cout << answer << endl;
    }
  }
}
