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

public class Main {
    public static void main(String[] args) {
        FastReader input=new FastReader();
        PrintWriter out=new PrintWriter(System.out);
        int T=1;
        while(T-->0)
        {
            int q,x;
            q=input.nextInt();
            x=input.nextInt();
            int ans=0;
            HashMap<Integer,Integer> map=new HashMap<>();
            for(int i=0;i<q;i++)
            {
                int y=input.nextInt();
                y=y%x;
                if(map.containsKey(y))
                {
                    map.put(y,map.get(y)+1);
                }
                else
                {
                    map.put(y,1);
                }
                while(true)
                {
                    int v=ans%x;
                    if(map.containsKey(v))
                    {
                        if(map.get(v)==1)
                        {
                            map.remove(v);
                        }
                        else
                        {
                            map.put(v,map.get(v)-1);
                        }
                        ans++;
                    }
                    else
                    {
                        break;
                    }
                }
                out.println(ans);
            }
        }
        out.close();
    }
    static 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;
        }
    }
}