import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by Katushka on 22.01.2020.
 */
public class MEXMaximisation {
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        int q = in.nextInt();
        int x = in.nextInt();
        int[] mods = new int[x];
        int cur = 0;

        for (int i = 0; i < q; i++) {
            int y = in.nextInt();
            if (y % x == cur % x) {
                cur += 1;
                while (mods[cur % x] > 0) {
                    mods[cur % x] -= 1;
                    cur += 1;
                }
            } else {
                mods[y % x] += 1;
            }
            System.out.println(cur);
        }
    }

    private 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() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    final String str = reader.readLine();
                    tokenizer = new StringTokenizer(str);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextString() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

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

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

        public char nextChar() {
            return next().charAt(0);
        }
    }
}
