import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {
    void run() throws IOException {
        int q = nextInt();
        int x = nextInt();
        int[] a = new int[x];
        TreeSet<pair> ts = new TreeSet<>();
        for (int i = 0; i < a.length; i++) {
            ts.add(new pair(0, i));
        }
        for (int i = 0; i < q; i++) {
            int add = nextInt();
            add %= x;
            ts.remove(new pair(a[add], add));
            a[add]++;
            ts.add(new pair(a[add], add));
            pair f = ts.first();
            pw.println(f.col * x + f.ost);
        }
        pw.close();
    }

    class pair implements Comparable<pair> {
        int col, ost;

        public pair(int col, int ost) {
            this.col = col;
            this.ost = ost;
        }

        @Override
        public int compareTo(pair o) {
            if (this.col == o.col) return -Integer.compare(o.ost, this.ost);
            return -Integer.compare(o.col, this.col);
        }
    }


    Scanner sc = new Scanner(System.in);
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    //BufferedReader br = new BufferedReader(new FileReader("downloading.in"));

    StringTokenizer st = new StringTokenizer("");
    PrintWriter pw = new PrintWriter(System.out);
    //PrintWriter pw = new PrintWriter("downloading.out");

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

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

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

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

    public Main() throws FileNotFoundException {
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
}