/*package whatever //do not write package name here */

import java.util.*;
import java.io.*;
public class GFG {
    static class Pair implements Comparable<Pair>
    {
        int a; int b;
        Pair(int a, int b)
        {
            this.a = a;this.b = b;
        }
        int geta()
        {
            return this.a;
        }
        int getb()
        {
            return this.b;
        }
       
        public int compareTo(Pair c)
        {
            if(this.a != c.a)
            return Integer.compare(this.a,c.a);
            return Integer.compare(this.b,c.b);
        }
        public boolean equals(Object c)
        {
            if(this == c)
            return true;
            Pair c1 = (Pair)c;
            if(this.b == c1.b&&this.a==c1.a)
            return true;
            return false;
        }
        
    }
	public static void main (String[] args)throws IOException {
		BufferedReader br =  new BufferedReader(new InputStreamReader(System.in));
		String str[] = br.readLine().split(" ");
		int q = Integer.parseInt(str[0]); int x = Integer.parseInt(str[1]);
// 		PriorityQueue<> pq  = new PriorityQueue<>();
        TreeSet<Pair> set = new TreeSet<>();
        int modx[] = new int[x];
        for(int i = 0;i<x;i++)
        {
            set.add(new Pair(modx[i],i));
        }
        StringBuilder st = new StringBuilder();
		while(q-->0)
		{
		    int a = Integer.parseInt(br.readLine());
		    a = a%x;
		    if(set.contains(new Pair(modx[a],a)))
		    {
		        set.remove(new Pair(modx[a],a));
		        modx[a]++;
		      //  System.out.println("coming here");
		      
		        set.add(new Pair(modx[a],a));
		    }
		    Pair f = set.first();
		    st.append((f.a*x+f.b)+"\n");
		}
		System.out.println(st.toString());
	}
}