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


 
 
 
 
/*


*/
public class D {
	static FastReader sc=null;
	
	
	public static void main(String[] args) {
		sc=new FastReader();
		PrintWriter out=new PrintWriter(System.out);
		int q=sc.nextInt(),x=sc.nextInt();
		long next[]=new long[x];
		for(int i=0;i<x;i++)next[i]=i;
		SegTree s=new SegTree(0,x-1,next);
		while(q-->0) {
			int y=sc.nextInt()%x;
			next[y]+=x;
			s.set(y, next[y]);
			out.println(s.rangeMin(0, x-1));
		}
		out.close();

		
		

		
		
	}
	static class SegTree{
		SegTree left,right;
		int l,r;
		long min=0;
		SegTree(int l,int r,long a[]){
			this.l=l;
			this.r=r;
			if(l==r) {
				min=a[l];
				return;
			}
			else {
				int mid=(l+r)/2;
				left=new SegTree(l,mid,a);
				right=new SegTree(mid+1,r,a);
			}
			recalc();
		}
		public void set(int i,long val) {
			if(l==r) {
				this.min=val;
				return;
			}
			if(left.r>=i)left.set(i, val);
			else right.set(i, val);
			recalc();
		}
		public void recalc() {
			if(l==r)return;
			this.min=Math.min(left.min,right.min);
		}
		public long rangeMin(int l,int r) {
			if(l>this.r || r<this.l) return Integer.MAX_VALUE;
			else if(l<=this.l && r>=this.r) {
				return this.min;
			}
			else{
				return Math.min(left.rangeMin(l,r),right.rangeMin(l, r));
			}	
		}
		
	}
	
	
	
	static int[] ruffleSort(int a[]) {
		ArrayList<Integer> al=new ArrayList<>();
		for(int i:a)al.add(i);
		Collections.sort(al);
		for(int i=0;i<a.length;i++)a[i]=al.get(i);
		return a;
	}
	
	
	static void print(long a[]) {
		for(long e:a) {
			System.out.print(e+" ");
		}
		System.out.println();
	}
		
	static int[] reverse(int a[]) {
		ArrayList<Integer> al=new ArrayList<>();
		for(int i:a)al.add(i);
		Collections.sort(al,Collections.reverseOrder());
		for(int i=0;i<a.length;i++)a[i]=al.get(i);
		return a;
	}
		
	static void print(int a[]) {
		for(int e:a) {
			System.out.print(e+" ");
		}
		System.out.println();
	}
	
	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; 
        } 
        int[] readArray(int n) {
    		int a[]=new int [n];
    		for(int i=0;i<n;i++) {
    			a[i]=sc.nextInt();
    		}
    		return a;
    	}
    } 
}