#include<bits/stdc++.h>
#define ll long long
#define vll vector<ll>
#define lll pair<ll,ll>
#define ii pair<int, int>
#define vii vector<ii>
#define vi vector<int>
#define ff first
#define ss second
#define pb(a) push_back(a)
#define ppb() pop_back()
#define mkp(a,b) make_pair(a,b)
#define vs vector<string>
#define vc vector<char>
#define deb1(a) cout<<#a<<" "<<a<<"\n"
#define deb2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<"\n";
#define deb3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<"\n"
#define mms0(a) memset(a,0,sizeof(a))
#define mms1(a) memset(a,-1,sizeof(a))
#define FOR(a,b,c) for(int i=(a);i<(b);i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define _ 0
using namespace std;
int n,m;
vll v;

int main(){
   int n,x;
   cin>>n>>x;
   set<int> st;
   int cnt[x]={0};
   FOR(_,x,1){
      cnt[i]=i;
      st.insert(cnt[i]);
   }
   while(n--){
      int ele;
      cin>>ele;
      ele%=x;
      st.erase(cnt[ele]);
      cnt[ele]+=x;
      st.insert(cnt[ele]);
      cout<<*st.begin()<<"\n";
   }
}
