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

public class MexMaximizing {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out,false);
        int q = scanner.nextInt();
        int x = scanner.nextInt();
        int[] cnt = new int[x];
        int curlevel = 0;
        int curmex = 0;
        while(q-->0) {
            int y = scanner.nextInt();
            int rep = y % x;
            cnt[rep]++;
            if (rep == curmex % x) {
outer:
                while(true) {
                    for(int i = (curmex % x); i < x; i++) {
                        if (cnt[i] == curlevel) {
                            curmex = curlevel * x + i;
                            break outer;
                        }
                    }
                    curlevel++;
                    curmex = curlevel * x;
                }
            }
            //out.println(Arrays.toString(cnt));
            out.println(curmex);
        }
        out.flush();
    }
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        public FastScanner() {
            this(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 readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}
