

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

public class MEXmaximizing {
    public static void main(String[] args) throws IOException {
        FastScanner scan = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        
        int q = scan.nextInt();
        int x = scan.nextInt();
        int[] freq = new int[x];
        int mex = 0;
        for (int i = 0; i < q; i++) {
        	int n = scan.nextInt();
        	freq[n % x]++;
        	while (freq[mex % x] > 0) {
        		freq[mex % x]--;
        		mex++;
        	}
        	out.println(mex);
        }
        
        out.close();
    }
    
    public static void shuffle(int[] arr) {
    	Random rgen = new Random();
    	
    	for (int i = 0; i < arr.length; i++) {
    		int rPos = rgen.nextInt(arr.length);
    		int temp = arr[i];
    		arr[i] = arr[rPos];
    		arr[rPos]=temp;
    	}
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}