#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 4e5 + 10;
int a[N];
int n, x, t;
int main() {
cin >> n >> x;
while (n--) {
int m;
cin >> m;
a[m % x]++;
while (a[t % x]) {
a[t % x]--;
t++;
}
cout << t << "\n";
}
return 0;
}