import java.util.Scanner;
import java.util.TreeSet;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int q = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        
        StringBuilder sb = new StringBuilder();
        int[] mods = new int[x];
        TreeSet<Pair> set = new TreeSet<>();
        for(int i = 0; i < x; i++){
            set.add(new Pair(0, i));
        }
        for(int i = 0; i < q; i++){
            int y = Integer.parseInt(sc.next());
            y %= x;
            set.remove(new Pair(mods[y], y));
            mods[y]++;
            set.add(new Pair(mods[y], y));
            sb.append(x*set.first().a + set.first().b).append(System.lineSeparator());
        }
        System.out.print(sb);
    }
    
    static class Pair implements Comparable<Pair>{
        int a;
        int b;
        
        public Pair(int a, int b) {
            this.a = a;
            this.b = b;
        }
        
        @Override
        public int compareTo(Pair p) {
            
            if(this.a > p.a){
                return 1;
            }else if(this.a < p.a){
                return -1;
            }else{
                if(this.b > p.b){
                    return 1;
                }else if(this.b < p.b){
                    return -1;
                }else{
                    return 0;
                }
            }
        }
    }
}