import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class hello
 {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; 
           } 
         
       }
    
    static String sum (String s)
    {
        String s1 = ""; 
        
        if(s.contains("a"))
            s1+="a";
        if(s.contains("e"))
            s1+="e";
        if(s.contains("i"))
            s1+="i";
        if(s.contains("o"))
            s1+="o";
        if(s.contains("u"))
            s1+="u";
        
            return s1;
            
        
    }
    

    public static HashMap<String, Integer> sortByValue(HashMap<String, Integer> hm) 
    { 
        // Create a list from elements of HashMap 
        List<Map.Entry<String, Integer> > list = 
               new LinkedList<Map.Entry<String, Integer> >(hm.entrySet()); 
  
        // Sort the list 
        Collections.sort(list, new Comparator<Map.Entry<String, Integer> >() { 
            public int compare(Map.Entry<String, Integer> o1,  
                               Map.Entry<String, Integer> o2) 
            { 
                return (o1.getValue()).compareTo(o2.getValue()); 
            } 
        }); 
          
        // put data from sorted list to hashmap  
        HashMap<String, Integer> temp = new LinkedHashMap<String, Integer>(); 
        for (Map.Entry<String, Integer> aa : list) { 
            temp.put(aa.getKey(), aa.getValue()); 
        } 
        return temp; 
    } 
    
    
public static void main(String args[])
    {
        FastReader input =new FastReader();
      
        int n  = input.nextInt();
        
        TreeMap<Integer,Integer> map = new TreeMap<Integer,Integer>();
        int x = input.nextInt();
        int mex =0;
        int max = -1;
        int a[] = new int[x];
  int count =0;
        for(int i=0;i<n;i++)
        {
        	int z = input.nextInt();
        	
        	
        	a[z%x]++;
        	
        	int min = Integer.MAX_VALUE;
        	int y = 0;
        	
        	
        	while(true)
        	{
        		if(a[count%x]<=0)
        			break;
        		else
        		{
        			a[count%x]--;
        			count++;
        		}
        	}
        	//System.out.println(min + " " + y);
        	System.out.println(count);
        	
        	
        	
        
        }
        
        
        
    }
        

static int findMin(int arr[], int low, int high) 
{ 
    
    if (high < low)  return arr[0]; 

    
    if (high == low) return arr[low]; 

    int mid = low + (high - low)/2; /*(low + high)/2;*/

    // Check if element (mid+1) is minimum element. Consider 
    // the cases like {3, 4, 5, 1, 2} 
    if (mid < high && arr[mid+1] < arr[mid]) 
        return arr[mid+1]; 

    // Check if mid itself is minimum element 
    if (mid > low && arr[mid] < arr[mid - 1]) 
        return arr[mid]; 

    // Decide whether we need to go to left half or right half 
    if (arr[high] > arr[mid]) 
        return findMin(arr, low, mid-1); 
    return findMin(arr, mid+1, high); 
} 




public static boolean range(int x,int y,int n,int m)
{
	if(x<0 || x>n-1 || y<0 || y>m-1)
		return false;
	
	
	return true;
}
   
public static int even_element(int b[],int n)
{
	int c[] = new int[n/2 + 1];
	int l=0;
	for(int i=1;i<n;i+=2)
	{
		c[l] = b[i];
		
		System.out.print(c[l] + " ");
		l++;
	}
	System.out.println();
	if(c.length!=1)
	{
		return even_element(c,n/2);
	}
	else
		return c[0];
}

      
       	
        	
        	
 
    
    static boolean isPrime(int n) 
    { 
        // Corner case 
        if (n <= 1) 
            return false; 
  
        // Check from 2 to n-1 
        for (int i = 2; i < n; i++) 
            if (n % i == 0) 
                return false; 
  
        return true; 
    } 
 }
 
 
class Pair
{
    int x,y;
    Pair(int x,int y)
    {
        this.x=x;
        this.y=y;
    }
}
 

 class SortbyX implements Comparator<Pair> 
 { 
     // Used for sorting in ascending order of 
     // roll name 
     public int compare(Pair a, Pair b) 
     { 
         return a.x-b.x; 
     } 
 } 
 class SortByY implements Comparator<Pair>
 {
     public int compare(Pair a,Pair b)
     {
         if(a.x==b.x) return a.y-b.y;
         return 0;
     }
 }
