#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4000 * 100 + 10;
int t, x;
int ans[MAXN];
set<pair<int, int>> s;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> t >> x;
  int pt = -1, pt2 = -1;
  while (t--) {
    int a;
    cin >> a;
    ans[a % x]++;
    int m = a % x;
    auto it = s.lower_bound({ans[m] - 1, m});
    if (it != s.end() && it->first == ans[m] - 1 && it->second == m)
      s.erase(it);
    s.insert({ans[m], m});
    if (ans[a % x] == 1 && (a % x == pt + 1)) pt++;
    if (ans[a % x] == (s.begin()->first) + 1 && (a % x == pt2 + 1)) pt2++;
    cout << (pt + 1) * (s.begin()->first) + pt2 + 1 << endl;
  }
  return 0;
}
