The only difference between easy and hard versions is constraints.

A session has begun at Beland State University. Many students are taking exams.

Polygraph Poligrafovich is going to examine a group of n students. Students will take the exam one-by-one in order from 1-th to n-th. Rules of the exam are following:

  * The i-th student randomly chooses a ticket. 
  * if this ticket is too hard to the student, he doesn't answer and goes home immediately (this process is so fast that it's considered no time elapses). This student fails the exam. 
  * if the student finds the ticket easy, he spends exactly t_i minutes to pass the exam. After it, he immediately gets a mark and goes home. 



Students take the exam in the fixed order, one-by-one, without any interruption. At any moment of time, Polygraph Poligrafovich takes the answer from one student.

The duration of the whole exam for all students is M minutes (max t_i ≤ M), so students at the end of the list have a greater possibility to run out of time to pass the exam.

For each student i, you should count the minimum possible number of students who need to fail the exam so the i-th student has enough time to pass the exam.

For each student i, find the answer independently. That is, if when finding the answer for the student i_1 some student j should leave, then while finding the answer for i_2 (i_2>i_1) the student j student does not have to go home.

Input

The first line of the input contains two integers n and M (1 ≤ n ≤ 100, 1 ≤ M ≤ 100) — the number of students and the total duration of the exam in minutes, respectively.

The second line of the input contains n integers t_i (1 ≤ t_i ≤ 100) — time in minutes that i-th student spends to answer to a ticket.

It's guaranteed that all values of t_i are not greater than M.

Output

Print n numbers: the i-th number must be equal to the minimum number of students who have to leave the exam in order to i-th student has enough time to pass the exam.

Examples

Input


7 15
1 2 3 4 5 6 7


Output


0 0 0 0 0 2 3 

Input


5 100
80 40 40 40 60


Output


0 1 1 2 3 

Note

The explanation for the example 1.

Please note that the sum of the first five exam times does not exceed M=15 (the sum is 1+2+3+4+5=15). Thus, the first five students can pass the exam even if all the students before them also pass the exam. In other words, the first five numbers in the answer are 0.

In order for the 6-th student to pass the exam, it is necessary that at least 2 students must fail it before (for example, the 3-rd and 4-th, then the 6-th will finish its exam in 1+2+5+6=14 minutes, which does not exceed M).

In order for the 7-th student to pass the exam, it is necessary that at least 3 students must fail it before (for example, the 2-nd, 5-th and 6-th, then the 7-th will finish its exam in 1+3+4+7=15 minutes, which does not exceed M).
import java.io.*;
import java.util.*;
import java.lang.Math;

public class Main{
	static BufferedReader reader;
	static StringTokenizer tokenizer;
	static PrintWriter writer;

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

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

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

	static String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
	static String nexts() throws IOException {
	  	  tokenizer = new StringTokenizer(reader.readLine());
	   	 String s="";
	   	 while (tokenizer.hasMoreTokens()) {
			s+=tokenizer.nextElement()+" ";
		}
		return s;
	}
	public static int gcd(int x, int y){
		if (y == 0) return x; else return gcd(y, x % y);
	}

	public static boolean isPrime(int nn) 
	    { 
	         if(nn<=1){
		 return false; }
	        if(nn<=3){
		 return true; }
	      if (nn%2==0||nn%3==0){
		 return false; }
	        for (int i=5;i*i<=nn;i=i+6){ 
	            if(nn%i==0||nn%(i+2)==0){
	            	return false;  }
	            }
	         return true; 
	    } 

	public static void shuffle(int[] A) {
		for (int i = 0; i < A.length; i++) {
			int j = (int)(i * Math.random());
			int tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
		}
	}
	public static void shufflel(Long[] A) {
		for (int i = 0; i < A.length; i++) {
			int j = (int)(i * Math.random());
			long tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
		}
	}

	public static String reverse(String input)
 	   {
	        StringBuilder input2=new StringBuilder();
	        input2.append(input);
	        input2 = input2.reverse();
	        return input2.toString();
	    }


	 public static long power(int x, long n)
	{
	//    long mod = 1000000007;
		if (n == 0) {
			return 1;
		}

		long pow = power(x, n / 2);

		if ((n & 1) == 1) {
			return (x * pow * pow);
		}
		return (pow * pow);
	}
	public static long power(long x, long y, long p)     //x^y%p
	    { 
  	       long res = 1; 
	       x = x % p; 
  	       while (y > 0) { 
 	 	 if (y % 2 == 1) {
      	        	        res = (res * x) % p; 
		 }
  		 y = y >> 1; // y = y/2 
     	     	 x = (x * x) % p; 
     	         } 
  	         return res; 
    	} 

	 static long ncr(int n, int k)  
   	 { 
           		 long res = 1; 
  		   // Since C(n, k) = C(n, n-k)  
 		       if (k > n - k) { 
     		       k = n - k; 
      		  } 
  		  // Calculate value of [n*(n-1)*---*(n-k+1)] / [k*(k-1)*---*1]  
     		   for (int i = 0; i < k; ++i) { 
        		    res *= (n - i); 
         		   res /= (i + 1); 
     		   } 
  		  return res; 
 	   }
	public static int inv(int a, int m)     //Returns modulo inverse of a with respect to m using extended euclid algorithm
	    { 
	        int m0=m,t,q; 
	        int x0=0,x1=1; 
      	        if(m==1){
	                return 0; }
                 	         while(a>1) 
     	        {  
   	                q=a/m; 
    	                t=m; 
                                 m=a%m;a=t; 
    	                t=x0; 
     	                x0=x1-q*x0; 
      	                x1=t; } 
    	          if(x1<0){
 	   	 x1+=m0; }
   	           return x1; 
	    } 

	static int modInverse(int n, int p) 
  	{ 
    	          return (int)power((long)n, (long)(p - 2),(long)p); 
	 } 
	static int ncrmod(int n, int r, int p) 
   	 { 
	        if (r == 0)        // Base case 
	            return 1; 
  	        int[] fac = new int[n + 1];         // Fill factorial array so that we can find all factorial of r, n and n-r 
	        fac[0] = 1; 
	        for (int i = 1; i <= n; i++) 
                                     fac[i] = fac[i - 1] * i % p; 
   	         return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;     //IMPORTANT
    	}	 

	static int upper(int a[], int x)   //Returns rightest index of x in sorted arr else -1
  	  {                                                //If not present returns index of just smaller element
  	            int n=a.length;
    	        int l=0;
                int r=n-1;
                int ans=-1;
                while(l<=r){
                    int m=(r-l)/2+l;
                    if(a[m]<=x){
                        ans=m;
                        l=m+1;
                    }
                    else{
                        r=m-1;
                    }
                }
                 return ans;  
                } 
	static int lower(int a[], int x)     //Returns leftest index of x in sorted arr else n
 	   {                                                  //If not present returns index of just greater element
 	            int n=a.length;
   	            int l=0;
                int r=n-1;
                int ans=n;
                while(l<=r){
                    int m=(r-l)/2+l;
                    if(a[m]>=x){
                        ans=m;
                        r=m-1;
                    }
                    else{
                         l=m+1;
                    }
                }
                 return ans; 
                 } 

	public static long stringtoint(String s){ // Convert bit string to number
		long a = 1;
		long ans = 0;
		StringBuilder sb = new StringBuilder();
		sb.append(s);  
		sb.reverse();
		s=sb.toString();
		for(int i=0;i<s.length();i++){
			ans = ans + a*(s.charAt(i)-'0');
			a = a*2;
		}
		return ans;
	}
 
	String inttostring(long a,long m){        // a is number and m is length of string required
		String res = "";                     // Convert a number in bit string representation
		for(int i=0;i<(int)m;i++){
			if((a&(1<<i))==1){
				res+='1';
			}else
				res+='0';
		}
		StringBuilder sb = new StringBuilder();
		sb.append(res);  
		sb.reverse();
		res=sb.toString();
		return res;
    }
	
	 static class R implements Comparable<R>{
	        int x, y;
	        public  R(int x, int y) {           //a[i]=new R(x,y);
	            this.x = x;
	            this.y = y;
	        }
	        public int compareTo(R o) {
            		return x-o.x;     //Increasing order(Which is usually required)
        		}
	    }   
/*   FUNCTION TO SORT HASHMAP ACCORDING TO VALUE
//USE IT AS FOLLOW	

//Make a new list
List<Map.Entry<Integer, Integer> > list = 
               new LinkedList<Map.Entry<Integer, Integer> >(h.entrySet()); 
  
        // Sort the list 
        Collections.sort(list, new Comparator<Map.Entry<Integer, Integer> >() { 
            public int compare(Map.Entry<Integer, Integer> o1,  
                               Map.Entry<Integer, Integer> o2) 
            { 
                return (o1.getValue()).compareTo(o2.getValue());     //This is used to sort string stored as VALUE, use below function here accordingly
            } 
        }); 
          
        // put data from sorted list to new hashmap  
        HashMap<String, Integer> temp = new LinkedHashMap<String, Integer>(); 
        for (Map.Entry<String, Integer> aa : list) { 
            temp.put(aa.getKey(), aa.getValue()); 
        } 
        return temp;   //Now temp is our new sorted hashmap
OR
	for(int i = 0;i<h.size();i++)  //accessing elements from the list made
		{
			int count = list.get(i).getValue();    //Value
			while(count >= 0)
			{
					int key=list.get(i).getKey();  //key
					count -- ;
			}
		}

////////////////////////////////////////////////////////////////////////////////////////
public int compare(Entry<Integer, Integer> o1, Entry<Integer, Integer> o2) 
	{
		if(o1.getValue() != o2.getValue())
			return o1.getValue() > o2.getValue()?1:-1;  //Sorts Value in increasing order
		else if(o1.getValue() == o2.getValue()){
			return o1.getKey() > o2.getKey() ? 1:-1;  //If value equal, then sorts key in increasing order
		}
		
		return Integer.MIN_VALUE;
	}
*/
//Check if palindrome string - System.out.print(A.equals(new StringBuilder(A).reverse().toString())?"Yes":"No");
	public static void main(String[] args) throws IOException {
		reader = new BufferedReader(new InputStreamReader(System.in));
		tokenizer = null;
		writer = new PrintWriter(System.out);
		solve();
		reader.close();
		writer.close();
	}
	
	private static void solve() throws IOException {
	//	int t = nextInt();
	//	while(t-->0){
			//String s= nextToken();
			//String[] s = str.split("\\s+");
			//ArrayList<Integer> ar=new ArrayList<Integer>();
			//HashSet<Integer> set=new HashSet<Integer>();
			//HashMap<Integer,String> h=new HashMap<Integer,String>();
			//R[] a1=new R[n];
			//char[] c=nextToken().toCharArray();
			//PriorityQueue<Integer> pq=new PriorityQueue<Integer>(Collections.reverseOrder());
			//NavigableSet<Integer> pq=new TreeSet<>();
			int n = nextInt();
			int k = nextInt();
			//long n = nextLong();

			int[] arr=new int[n];
			//long[] a=new long[n];
			for(int i=0;i<n;i++){
				arr[i]=nextInt();
			}
			//shuffle(a);
			//shufflel(a);
			//Arrays.sort(a);
			int[] presum=new int[n];
			presum[0]=arr[0];
            for(int i=1;i<n;i++){
                presum[i]=presum[i-1]+arr[i];
            }
            int[] ans=new int[n];
            for(int i=0;i<n;i++){
                PriorityQueue<Integer> pq=new PriorityQueue<Integer>(Collections.reverseOrder());
                for(int j=0;j<i;j++){
                    pq.add(arr[j]);
                }
                int cnt=0;
                int val=presum[i]-arr[i];
                while(val>k-arr[i]){
                    cnt++;
                    val-=pq.peek();
                    pq.remove();
                }
                ans[i]=cnt;
            }
            for(int i=0;i<n;i++){
                writer.print(ans[i]+" ");
            }
            writer.println();
            
			
		 }
//	}
}