import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
//BigInteger A;
//A= BigInteger.valueOf(54);
//ArrayList<Integer> a=new ArrayList<>();
//TreeSet<Integer> ts=new TreeSet<>();
//HashMap<Integer,Integer> hm=new HashMap<>();
//PriorityQueue<Integer> pq=new PriorityQueue<>();
public final class CF
{
    public static void main(String[]args)throws IOException
    {
        FastReader ob=new FastReader();
        //int t=ob.nextInt();
        //while(t-->0)
        {
            StringBuffer s=new StringBuffer();
            int q=ob.nextInt();
            int x=ob.nextInt();
            HashMap<Integer,Integer> hm=new HashMap<>();
            int x1=ob.nextInt();
            hm.put(x1,1);
            int mex;
            if(x1==0)
            mex=1;
            else
            mex=0;
            s.append(mex+"\n");
            while(q-->1)
            {
                x1=ob.nextInt();
                hm.put(x1,1);
                if(Math.abs(x1-mex)%x==0)
                {
                    ++mex;
                    while(hm.containsKey(mex))
                    ++mex;
                    s.append(mex+"\n");
                }
                else
                {
                    if(x1-mex>0)
                    {
                        int y=x1-((x1-mex)/x)*x;
                        while(hm.containsKey(y))
                        y+=x;
                        hm.put(y,1);
                        s.append(mex+"\n");
                    }
                    else
                    {
                        int y=x1+((((mex-x1)/x)+1)*x);
                        while(hm.containsKey(y))
                        y+=x;
                        hm.put(y,1);
                        s.append(mex+"\n");
                    }
                }
            }
            System.out.println(s);
        }
    }
}
class Pair
{
    int x,y;
    public Pair(int x,int y)
    {
        this.x=x;
        this.y=y;
    }
}
class PairComparator implements Comparator<Pair>
{
    //@override
    public int compare(Pair p1,Pair p2)
    {
        if(p1.y<p2.y)
        return 1;
        else if(p1.y>p2.y)
        return -1;
        else
        return 0;
    }
}
class FastReader {
    BufferedReader br;
    StringTokenizer st;
    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    public String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e)  {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }
    public String nextLine()
    {
        String s="";
        try {
        s=br.readLine();
        } catch (IOException e)  {
                e.printStackTrace();
            }
        return s;
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}