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

public class MyClass {
    public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int x = sc.nextInt();
      int temp=0;
      int[] a = new int[x];
      for(int i=0;i<n;i++){
          int in = sc.nextInt();
          a[in%x] = a[in%x] + 1;
          if(a[temp%x]>0){
              temp++;
              a[in%x] = a[in%x] - 1;
          }
          System.out.println(temp);
      }
    }
}