#include <bits/stdc++.h>   using namespace std;   int main() {     long long q, x;     cin >> q >> x;     long long n = q;     long long a[n];     map<long long, long long> m;     long long min = 0;     map<long long, long long> f;     for (long long i = 0; i < n; i++) {       cin >> a[i];       long long mod = a[i] % x;       f[mod]++;       m[mod + ((f[mod] - 1) * x)]++;       while (m[min] == 1) min++;       cout << min << endl;     }     map<long long, long long>::iterator it;   }   