import java.io.*;
import java.math.BigInteger;
import java.util.*;


public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader input, PrintWriter out) {
            long q = input.nextLong();
            long x = input.nextLong();

            Set<Long> s = new HashSet<>();
            Map<Long,Long> mapp = new HashMap<>();

            long val,in,tp;
            long ans = 0;
            while(q-- > 0){
                val = input.nextLong();

                tp = val % x;
                if(!mapp.containsKey(tp)){
                    in = tp;
                }
                else{
                    in = mapp.get(tp);
                }

                mapp.put(tp,in + x);
                s.add(in);

                for(long i = ans;i <= 100000000L;i++){
                    if(!s.contains(i)){
                        ans = i;
                        out.println(ans);
                        break;
                    }
                }
            }
        }


    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            return nextImpl(0);
        }

        public String nextLine(){
            return nextImpl(1);
        }

        private String nextImpl(int op){
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    if(op == 0){
                        tokenizer = new StringTokenizer(reader.readLine());
                    }
                    else{
                        tokenizer = new StringTokenizer(reader.readLine(),"\n");
                    }
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public float nextFloat() {
            return Float.parseFloat(next());
        }

        public BigInteger nextBigInteger(){
            return new BigInteger(next());
        }


    }
}