import java.util.Scanner;

public class MEXmaximizing {

    public static void main(String[] args) {

        Scanner s = new Scanner(System.in);

        int q = s.nextInt();
        int x = s.nextInt();
        int cnt[]=new int[x];
        int mex=0;

        StringBuilder sb=new StringBuilder("");

        while(q-- != 0) {
            int val=s.nextInt();
            cnt[val%x]++;

            while(cnt[mex%x]!=0) {
                cnt[mex%x]--;
                mex++;
            }

            sb.append(mex+"\n");
        }
        System.out.println(sb);
    }
}
