#include <bits/stdc++.h>
using namespace std;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
int main() {
  int q, x;
  cin >> q >> x;
  long long a[x];
  for (int i = 0; i < x; i++) a[i] = i;
  map<long long, long long> f;
  int ans = 0;
  for (int i = 0; i < q; i++) {
    long long y;
    cin >> y;
    y = y % x;
    f[a[y]] = 1;
    a[y] = a[y] + x;
    while (f[ans] > 0) {
      ans++;
    }
    cout << ans << endl;
  }
}
