#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using namespace std;
const long long mod = 1000000007;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long q, x;
  cin >> q >> x;
  set<long long> s, t;
  long long ans = 0;
  long long arr[x - 1];
  for (long long i = 0; i < x; i++) arr[i] = i;
  while (q--) {
    long long a;
    cin >> a;
    if (abs(a - ans) % x == 0) {
      s.insert(ans);
      long long u = a % x;
      arr[u] += x;
      for (auto x1 : t) {
        if (x1 == (*s.rbegin() + 1)) {
          s.insert(x1);
          t.erase(x1);
        } else
          break;
      }
    } else {
      long long b = a % x;
      t.insert(arr[b]);
      arr[b] += x;
    }
    if (s.size()) ans = *s.rbegin() + 1;
    cout << ans << endl;
  }
}
