#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {

        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int lcm(int a, int b)
{
    return (a * b) / __gcd(a, b);
}
 

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc;
    tc = 1;
    while (tc--)
    {
      int n,x,a;
      cin >> n >> x;
      int mex = 0;
      map<int, int> mp;
      for (int i = 0; i < n;i++){
          cin >> a;
          if(a>=mex){
              int c = a - mex;
              c /= x;
              a -= c * x;
          }
          else{
              int c = mex - a;
              c = ceil((c * 1.0) / x);
              a += c * x;
          }
         // cout << a << endl;
          mp[a]++;
          while(mp[mex]!=0){
              mex++;
          }
         cout << mex << endl;
      }
    }
    
    return 0;
}