import java.io.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)throws Exception
	{
	    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	    PrintWriter pw=new PrintWriter(System.out);
	    
	        String s[]=(br.readLine()).split(" ");
	        int q=Integer.parseInt(s[0]);
	        long x=Long.parseLong(s[1]);
            long a[]=new long[q];//queries
            for(int i=0;i<q;i++)
            {
                a[i]=Long.parseLong(br.readLine());
            }
            int xx=(int)x;
            long rem[]=new long[xx];
            for(int i=0;i<x;i++)
            {
                rem[i]=i;
            }
            long ar[]=new long[q];//array elements
            long mex[]=new long[q+1];//initially all 0s, we turn them -1,meaning included in array ar
            int pmex=0;//pointer to mex
            for(int i=0;i<q;i++)
            {
                int temp=(int)(a[i]%x);
                ar[i]=rem[temp];
                rem[temp]+=x;
               // temp=(int)(ar[i]);
                if(ar[i]<mex.length)
                {
                    temp=(int)(ar[i]);
                    mex[temp]=-1l;
                }
                while(mex[pmex]!=0)
                {
                    pmex++;
                    if(pmex>=mex.length)
                    {
                        break;
                    }
                }
                pw.println(pmex);
            }
	    
	    pw.flush();
	    
	}
}
