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

public class Abc {

    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        int q=sc.nextInt(),x=sc.nextInt();
        TreeSet<Integer> s[]=new TreeSet[5*100000];
        for (int i=0;i<s.length;i++)s[i]=new TreeSet<>();
        TreeSet<Integer> che=new TreeSet<>();
        for (int i=0;i<s.length;i++){
            s[i%x].add(i);
            che.add(i);
        }
        StringBuilder sb=new StringBuilder();
        while (q-->0){
            int y=sc.nextInt();
            if (!s[y%x].isEmpty()){
                int a=s[y%x].pollFirst();
                che.remove(a);
            }
            sb.append(che.first()+"\n");
        }
        System.out.print(sb);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(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 nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}