import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class MexRemaining {
    public static void main(String[] args){
        Scanner obj=new Scanner(System.in);
        int n=obj.nextInt();
        int x=obj.nextInt();
        int[] count=new int[x];
        TreeSet<Pair> set=new TreeSet<>(new The_Comparator());
        for(int i=0;i<n;i++){
            int cur=obj.nextInt();
            cur=cur%x;
            // System.out.println("The print value is "+cur);
            if(count[cur]>0){
                //already existing pair
                set.remove(new Pair(cur,count[cur]));
                // System.out.println("***********************"+set.size());
                count[cur]++;
                set.add(new Pair(cur,count[cur]));
                // System.out.println("***********************"+set.size());
            }else{
                Pair pair=new Pair(cur);
                count[cur]++;
                set.add(pair);
            }
            Pair minPair=set.first();
            int res=minPair.mod+minPair.count*x;
            Iterator iterator=set.iterator();
            // System.out.println("*******************");
            // while(iterator.hasNext()){
            //     System.out.println(iterator.next());
            // }
            // System.out.println("*******************");
            System.out.println(res);
            
        }
    }
}

class Pair{
    int mod;
    int count;
    Pair(int mod){
        this.mod=mod;
        count=1;
    }
    Pair(int mod,int count){
        this.mod=mod;
        this.count=count;
    }
    public String toString(){
        return this.mod+" "+this.count;
    }
    // public int compare(Pair p1,Pair p2){
    //     if(p1.count!=p2.count){
    //         return p1.count-p2.count;
    //     }
    //     return p1.mod-p2.mod;
    // }
    // public int compareTo(Pair p){
    //     // return this.count-p.count;
    //     if(this.count!=p.count){
    //         return this.count-p.count;
    //     }
    //     return this.mod-p.mod;
    // }
    // public int equals(Pair p1,Pair p2){
    //     if(p1.count!=p2.count){
    //         return p1.count-p2.count;
    //     }
    //     return p1.mod-p2.mod;
    // }
    // public boolean equals(Object obj){
    //     Pair p=(Pair)obj;
    //     if(this.count==p.count&&this.mod==p.mod){
    //         return true;
    //     }
    //     return false;
    // }
}

class The_Comparator implements Comparator<Pair> { 
    public int compare(Pair p1,Pair p2){
        if(p1.count!=p2.count){
            return p1.count-p2.count;
        }
        return p1.mod-p2.mod;
    }
} 