import java.util.*;
import java.io.*;
public class hhh {
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////                                                                                                               /////////
////////                                                                                                               /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM         OOOOOO             SSSSSSS      EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMMMM      MMMMMM      OOO      OOO        SSSS   SSS     EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEE           MMMM MMM  MMM MMMM    OOO          OOO    SSSS       SSS   EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM  MMMMMM  MMMM   OOO            OOO   SSSS             EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM  OOO              OOO   SSSSSSS         EEEEE          /////////
////////   HHHHHHHHHHHHHHHH  EEEEEEEEEEE     MMMM          MMMM  OOO              OOO      SSSSSS       EEEEEEEEEEE    /////////
////////   HHHHHHHHHHHHHHHH  EEEEEEEEEEE     MMMM          MMMM  OOO              OOO         SSSSSSS   EEEEEEEEEEE    /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM   OOO            OOO              SSSS  EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM    OOO          OOO     SSS       SSSS  EEEEE          /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM      OOO      OOO        SSS    SSSS    EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM         OOOOOO             SSSSSSS      EEEEEEEEEEEEE  /////////
////////                                                                                                               /////////
////////                                                                                                               /////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class FenwickTree { // one-based DS

        int n;
        int[] ft;

        FenwickTree(int size) { n = size; ft = new int[n+1]; }

        int rsq(int b) //O(log n)
        {
            int sum = 0;
            while(b > 0) { sum += ft[b]; b -= b & -b;}		//min?
            return sum;
        }

        int rsq(int a, int b) { return rsq(b) - rsq(a-1); }

        void point_update(int k, int val)	//O(log n), update = increment
        {
            while(k <= n) { ft[k] += val; k += k & -k; }		//min?
        }

    }
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
//        FileWriter f = new FileWriter("C:\\Users\\Ibrahim\\out.txt");
        PrintWriter pw = new PrintWriter(System.out);
        int q = sc.nextInt();
        int x = sc.nextInt();
        int[]count= new int[x+1];
        int id=0;
        int cc=1;
        while (q-->0){
            int c = sc.nextInt();
            count[c%x]++;
            while (id<x &&count[id]>=cc){
                id++;
                if (id==x){
                    cc++;
                    id=0;
                }
            }
            long ans =(cc-1)*x+id;
            pw.println(ans);
        }
        pw.flush();
    }
    static class Pair{
        int val,idx;
        Pair(int a,int b){
            val=a;
            idx=b;
        }

        @Override
        public String toString() {
            return val+" "+idx;
        }
    }
    static class SparseTable{
        int N,K;
        Pair[][]st;
        int arr[],log[];
        SparseTable(int [] a) {
            int k = 1;
            while (1 << k < a.length) k++;
            K = k;
            N = a.length;
            arr = a;
            st = new Pair[K+1][N+1];
            log= new int[N+1];
            log[1]=0;
            for (int i =2;i<=N;i++)
                log[i]=1+log[i/2];
            Build();
        }
        void Build(){
            for (Pair[]z:st)Arrays.fill(z,new Pair(0,0));
            for (int i =0;i<N;i++)
                st[0][i]=new Pair(arr[i],i);

            for (int j =1;j<=K;j++)
                for (int i =0;i+(1<<j)<=N;i++)
                    if (st[j-1][i].val>st[j-1][i + (1<<(j-1))].val)
                        st[j][i]=st[j-1][i];
                    else st[j][i]=st[j-1][i + (1<<(j-1))];


        }
        int Query(int l,int r){
            int t =log[r-l+1];
            if (st[t][l].val>st[t][r-(1<<t)+1].val)
                    return  st[t][l].idx;
            return st[t][r-(1<<t)+1].idx;
        }
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }

}
