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

public class tank {

    static final FastScanner fs = new FastScanner();

    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int t = 1;
        while(t-->0) {
            run_case();
        }

        out.close();
    }

    static void run_case() {
        int n = fs.nextInt(), x = fs.nextInt(), mex = 0;
        int[] arr = fs.readArray(n);

        //int[] cnt = new int[1000_000];
        int[] hm = new int[x];

        for (int i = 0; i < n; i++) {
            hm[arr[i] % x]++;
            while(true) {
                if(hm[mex % x] > 0) {
                    hm[mex % x]--;
                    mex++;
                }else break;
            }
            out.println(mex);
        }
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        String nextLine(){
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }

            return "";
        }

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

        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }

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

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