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

public class Main {
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
    
	public static void main (String[] args) {
		FastReader s = new FastReader();
		StringBuilder sb = new StringBuilder();
		int q = s.nextInt();
		int x = s.nextInt();
		long[] a = new long[x];
		PriorityQueue<Long> pq = new PriorityQueue<>(new Comparator<Long>(){
		    public int compare(Long a,Long b){
		        if(a>=b)
		        return 1;
		        return -1;
		    }
		});
		for(int i=0;i<x;i++)
		{
		    a[i] = (long)i;
		    pq.add(a[i]);
		}
		for(int i=0;i<q;i++)
		{
		    int y = s.nextInt();
		    int index = y%x;
		    a[index] = a[index] + (long)x;
		    while(true)
		    {
		        long w = pq.peek();
		        int wIndex = (int)(w%(long)x);
		        long actual = a[wIndex];
		        if(actual!=w)
		        {
		            pq.poll();
		            pq.add(actual);
		        }
		        else
		        break;
		    }
		    sb.append(pq.peek()).append("\n");
		}
		System.out.print(sb.toString());
		System.out.flush();
	}
}