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

public class Main 
{ 
	public static void main(String[] args) throws Exception
	{
		Scanner sc = new Scanner(System.in) ; 
		PrintWriter out = new PrintWriter(System.out) ; 
		TreeSet<Long> set = new TreeSet<Long>() ; 
		
		int q = sc.nextInt() ; 
		int x = sc.nextInt() ; 
		
		for(int i = 0 ; i <= q  ; i++)
			set.add(i * 1L) ; 
		int next [] = new int [x] ; 
		while(q-->0)
		{
			int y = sc.nextInt() % x;
			long num = y + next[y] * x ; 
			next[y] ++ ; 
			set.remove(num) ; 
			out.println(set.first());
		}
		out.flush();
		out.close();
	}
	
	
	static class Scanner 
	{
		BufferedReader br;
		StringTokenizer st;

		Scanner(InputStream in) 
		{
			br = new BufferedReader(new InputStreamReader(in));
		}

		String next() throws Exception 
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		int nextInt() throws Exception { return Integer.parseInt(next());}

		long nextLong() throws Exception { return Long.parseLong(next()); }
		
		double nextDouble() throws Exception { return Double.parseDouble(next());}
	}

}
