import java.util.*;
import java.io.*;

public class MyClass {
    public static void main(String args[]) throws IOException{
      FastReader sc = new FastReader();
      int n = sc.nextInt();
      int x = sc.nextInt();
      int temp=0;
      StringBuilder stringBuilder = new StringBuilder();
      int[] a = new int[x];
      for(int i=0;i<n;i++){
          int in = sc.nextInt();
          a[in%x]++;
          boolean f=true;
          while(f){
              f = false;
              if(a[temp%x]>0){
                  a[temp%x]--;
                  temp++;
                  f = true;
              }
          }
          stringBuilder.append(temp).append("\n");
      }
      System.out.println(stringBuilder);
    }
}

class FastReader{
    final private int BUFFER_SIZE = 1<<16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;
 
    public FastReader()throws IOException{
        din=new DataInputStream(System.in);
        bufferPointer=bytesRead=0;
        buffer=new byte[BUFFER_SIZE];
    }
    public FastReader(String filename)throws IOException{
        din=new DataInputStream(new FileInputStream(filename));
        bufferPointer=bytesRead=0;
        buffer=new byte[BUFFER_SIZE];
    }
 
    public String next()throws IOException{
        String s="";
        byte[] buf = new byte[1<<16];
        byte c;
        int count=0;
        while ((c = read()) != -1)
        {
            if (c == ' ' || c == '\n')
                break;
            buf[count++]=c;
            if(count==1<<16){
                s+=new String(buf,0,count);
                count=0;
                
            }
        }
        s+=new String(buf,0,count);
        return s;
    }
 
    public String nextLine()throws IOException{
        byte[] buf = new byte[64];
        byte c,count=0;
        while ((c = read()) != -1)
        {
            if (c == '\n')
                break;
            buf[count++]=c;
        }
        return new String(buf,0,count);
    }
 
    public int nextInt()throws IOException {
        int result=0;
        byte c=read();
        byte c1=c;
        while (c<'0' || c>'9'){
            c1=c;
            c=read();
        }
        boolean neg= (c1=='-');
        do {
            result=result*10 + c-'0';
        }while ((c=read())>='0' && c<='9');
        if(neg)
            return -result;
        return result;
    }
    public int[] na(int n)throws IOException {
    	int[] a = new int[n];
    	for(int i=0;i<n;i++)
    		a[i]=nextInt();
    	return a;
    }
    public long nextLong()throws IOException {
        long result=0;
        byte c=read();
        byte c1=c;
        while (c<'0' || c>'9'){
            c1=c;
            c=read();
        }
        boolean neg= (c1=='-');
        do {
            result=result*10 + c-'0';
        }while ((c=read())>='0' && c<='9');
        if(neg)
            return -result;
        return result;
    }
    public long[] nl(int n)throws IOException {
    	long[] a = new long[n];
    	for(int i=0;i<n;i++)
    		a[i]=nextLong();
    	return a;
    }
    public double nextDouble()throws IOException{
        double result=0,divisor=1;
        byte c=read(),c1=c;
        while(c<'0' || c>'9'){
            c1=c;
            c=read();
        }
        boolean neg=(c1=='-');
 
        do {
            result=result*10 + c-'0';
        }while((c=read())>='0' && c<='9');
 
        if (c=='.'){
            while ((c=read())>='0' && c<='9'){
                result += (c-'0')/(divisor=divisor*10);
            }
        }
        if(neg)
            return -result;
        return result;
    }
    private void fillBuffer() throws IOException {
        bytesRead = din.read(buffer,bufferPointer=0,BUFFER_SIZE);
        if(bytesRead==-1)
            buffer[0]=-1;
    }
    private byte read()throws IOException {
        if(bufferPointer==bytesRead)
            fillBuffer();
        return buffer[bufferPointer++];
    }
    public void close()throws IOException {
        if(din==null)
            return;
        din.close();
    }
}