import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    static int mod=(int)1e9+7;
    static int[] component;
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        int q=sc.nextInt(),x=sc.nextInt();
        TreeSet<Integer>[] tarr=new TreeSet[500000];
        for(int i=0;i<tarr.length;i++)tarr[i]=new TreeSet<>();
        TreeSet<Integer> treeSet=new TreeSet<>();
        for(int i=0;i<500000;i++){
            tarr[i%x].add(i);
            treeSet.add(i);
        }
        StringBuilder sb=new StringBuilder();
        while(q-->0){
            int z=sc.nextInt();
            if(!tarr[z%x].isEmpty()){
                int a=tarr[z%x].pollFirst();
                treeSet.remove(a);
            }
            sb.append(treeSet.first()+"\n");
        }
        System.out.println(sb);
    }
}
class disjointSet{
    int[] parent;
    int[] size;
    public disjointSet(int v){
        this.parent=new int[v];
        this.size=new int[v];
    }
    public void makeSet(){
        for(int i=0;i<parent.length;i++){
            parent[i]=i;
            size[i]=1;
        }
    }
    public int find(int v){
        if (v == parent[v]) return v;
        return parent[v]=find(parent[v]);
    }
    public void union(int a,int b){
        a=find(a);
        b=find(b);
        if(a!=b){
            if(size[a]<size[b])parent[a]=b;
            else parent[b]=a;
            size[a]+=size[b];
        }
    }
}
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;
    }
}