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.util.*;

import javax.lang.model.util.ElementScanner6;

import java.io.*;

public class Main{

    public static void main(String[] args) {

        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader inp = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.solve(inp, out);
        out.close();
        
        }



    static class Solver {


        class Node implements Comparable<Node>{
            int i;
            long c;
        
            Node(int i,long c)
            {
                this.i=i;
                this.c=c;


            }

        public int compareTo(Node n)
            {
                if(this.c==n.c)
                {
                    return Integer.compare(this.i, n.i);
                }
                return Long.compare(this.c, n.c);
            }
        }

        public boolean done(int[] sp,int[] par)
        {
            int root;

            root=findSet(sp[0],par);
            
        for(int i=1;i<sp.length;i++)
        {
                if(root!=findSet(sp[i], par))
                    return false;
        }
        return true;
        }
    public int findSet(int i,int[] par)
    {
        int x =i;
            boolean flag =false;
            while(par[i]>=0)
            {
                flag = true;
                i=par[i];
            }
            if(flag)
                par[x]=i;
            return i;
    }

    public void unionSet(int i,int j,int[] par)
    {
            int x = findSet(i, par);
            int y = findSet(j, par);
            if(x<y)
            {
                par[y]=x;
            }
            else
            {
                par[x]=y;
            }
    }

    public  long pow(long a, long b, long MOD) {
            if (b == 0) {
                return 1;
            }
            if (b == 1) {
                return a;
            }
            long val = pow(a, b / 2, MOD);
            if (b % 2 == 0) {
                return val * val % MOD;
            } else {
                return val * (val * a % MOD) % MOD;

            }
        
        }


        public void minPrimeFactor(int n,int[] s)
        {
            boolean prime[] = new boolean[n+1];
            Arrays.fill(prime, true);
            s[1]=1;
            s[2]=2;
            for(int i=4;i<=n;i+=2)
            {
                prime[i]=false;
                s[i]=2;
            }

            for(int i=3;i<=n;i+=2)
            {
                if(prime[i])
                {
                    s[i]=i;
                    for(int j=2*i;j<=n;j+=i)
                    {
                        prime[j]=false;
                        s[j]=i;
                    }
                }
            }
            
        }

        
        // public void findAllPrime(int n,ArrayList<Node> al,int s[])
        // {
        //     int curr = s[n];
        //     int cnt = 1;
        //     while(n>1)
        //     {
        //         n/=s[n];
        //         if(curr==s[n])
        //         {
        //             cnt++;
        //             continue;

        //         }
        //         Node n1 = new Node(curr,cnt);
        //         al.add(n1);

        //         curr=s[n];
        //         cnt=1;
        //     }
        // }

        

        public int binarySearch(int n,int k)
        {
            int left=1;
            int right=100000000+5;
            int ans=0;
            while(left<=right)
            {
                int mid = (left+right)/2;
                if(n/mid>=k)
                {
                    left = mid+1;
                    ans=mid;
                }
                else
                {
                    right=mid-1;
                }
            }

            return ans;
        }
        public boolean checkPallindrom(String s)
        {
            char ch[] = s.toCharArray();

            for(int i=0;i<s.length()/2;i++)
            {
                if(ch[i]!=ch[s.length()-1-i])
                    return false;
            }
            return true;
        }


        public void dfs_util(ArrayList<Integer>[] al,boolean vis[],int x,int lvl[],ArrayList<Integer>[] a)
        {
                
            vis[x] = true;
            
            // System.out.println("x "+x);
                for(int i=0;i<al[x].size();i++)
                {
                    
                    if(!vis[al[x].get(i)])
                    {
                        // System.out.println("s.size "+s.size());
                        lvl[al[x].get(i)]=1^lvl[x];
                        a[lvl[al[x].get(i)]].add(al[x].get(i));
                        dfs_util(al, vis, al[x].get(i),lvl,a);   
                        
                    }    
                    
                }

            
            
            
            
            return ;
        }

        public void dfs(ArrayList<Integer>[] al, int lvl[],ArrayList<Integer>[] a)
        {
            
            boolean vis[] = new boolean[al.length];
        
            int g =0;
            
            for(int i=0;i<al.length;i++)
            { 
            
            
                    if(!vis[i])
                    {
                        lvl[i]=0;
                        a[lvl[i]].add(i);
                        dfs_util(al,vis,i,lvl,a);
                        
                    }
                
            }

        


        }

        public void remove(ArrayList<Integer>[] al,int x)
        {
            for(int i=0;i<al.length;i++)
            {
                for(int j=0;j<al[i].size();j++)
                {

                    if(al[i].get(j)==x)
                        al[i].remove(j);

                }
            }
        }

        public long gcd(long a, long b) 
        { 
            if (a == 0) 
                return b; 
            return gcd(b % a, a); 
        }

      public  static String findSum(String str1, String str2)  
{  
   
    // Before proceeding further, make sure length  
    // of str2 is larger.  
    
    if (str1.length() > str2.length()){ 
        String t = str1; 
        str1 = str2; 
        str2 = t; 
    } 
  
    char ch1[] = new char[str1.length()];
    char ch2[]=  new char[str2.length()];
     ch1 = str1.toCharArray();
     ch2 =str2.toCharArray();
    // Take an empty String for storing result  
    String str = "";  
  
    // Calculate length of both String  
    int n1 = ch1.length, n2 = ch2.length;  
    int diff = n2 - n1;  
  
    // Initially take carry zero  
    int carry = 0;  
  
    // Traverse from end of both Strings  
    for (int i = n1 - 1; i>=0; i--)  
    {  
        // Do school mathematics, compute sum of  
        // current digits and carry  
        int sum = ((int)(ch1[i]-'0') +  (int)(ch2[i+diff]-'0') + carry);  
        str += (char)(sum % 10 + '0');  
        carry = sum / 10;  
    }  
  
    // Add remaining digits of str2[]  
    for (int i = n2 - n1 - 1; i >= 0; i--)  
    {  
        int sum = ((int)(ch2[i] - '0') + carry);  
        str += (char)(sum % 10 + '0');  
        carry = sum / 10;  
    }  
  
    // Add remaining carry  
    if (carry > 0)  
        str += (char)(carry + '0');  
  
    // reverse resultant String 
    return new StringBuilder(str).reverse().toString();   
}  

        public void printDivisors(long n,ArrayList<Long> al) 
        { 
            // Note that this loop runs till square root 
            for (long i=2; i<=Math.sqrt(n); i++) 
            { 
                if (n%i==0) 
                { 
                    // If divisors are equal, print only one 
                    if (n/i == i) 
                    {
                        
                            al.add(i);
                    }
                    
        
                    else // Otherwise print both 
                    {   
                            al.add(i); 
                            al.add(n/i);
                    }
                        
                } 
            } 
        } 

        public static long constructSegment(long seg[],long arr[], int low,int high,int pos)
        {
            if(low==high)
            {
                seg[pos] = arr[low]; 
                return seg[pos];
            }
            int mid = (low+high)/2;
            long t1=constructSegment(seg, arr,low , mid,(2*pos)+1);
            long t2=constructSegment(seg,arr,mid+1,high,(2*pos)+2);
            seg[pos] = t1+t2;
            return seg[pos];

        }
        public static long querySegment(long seg[],int low,int high,int qlow, int qhigh,int pos)
        {
            
            if(qlow<=low&&qhigh>=high)
            {
                return seg[pos];
            }
            else if(qlow>high||qhigh<low )
            {
                return 0;
            }
            else{
                long ans=0;
                int mid=(low+high)/2;
                ans+=querySegment(seg,low , mid, qlow, qhigh,  (2*pos)+1);
                ans+=querySegment(seg, mid+1, high, qlow, qhigh, (2*pos)+2);
            return ans; 
            }

        }
        public static int lcs( char[] X, char[] Y, int m, int n ) 
        { 
            if (m == 0 || n == 0) 
            return 0; 
            if (X[m-1] == Y[n-1]) 
            return 1 + lcs(X, Y, m-1, n-1); 
            else
            return Integer.max(lcs(X, Y, m, n-1), lcs(X, Y, m-1, n)); 
        } 

        public static long recursion(long start,long end,long cnt[],int a, int b)
        {

            long min=0;
            long count=0;
            int ans1=-1;
            int ans2=-1;
            int l=0;
            int r=cnt.length-1;
            while(l<=r)
            {
                int mid=(l+r)/2;
                if(cnt[mid]>=start)
                {
                    ans1=mid;
                    r=mid-1;
                }
                else
                {
                    l=mid+1;
                }
            }

            l=0;
            r=cnt.length-1;
            while(l<=r)
            {
                int mid=(l+r)/2;
                if(cnt[mid]<=end)
                {
                    ans2=mid;
                    l=mid+1;
                }
                else
                {
                    r=mid-1;
                }
            }
            
            if(ans1==-1||ans2==-1||ans2<ans1)
            {
                // System.out.println("min1 "+min);
                min=a;
                return a;

            }
            else
            {
                min=b*(end-start+1)*(ans2-ans1+1);
            }
            if(start==end)
            {
                // System.out.println("min "+min);
                return min;
            }
            long mid = (end+start)/2;
            min = Long.min(min,recursion(start, mid, cnt, a, b)+recursion(mid+1, end, cnt, a, b));
            // System.out.println("min "+min);
            return min;
        }

    



    

        private void solve(InputReader inp, PrintWriter out1) {
        
          int n = inp.nextInt();
          int m = inp.nextInt();
          int ans[] = new int[n];
          int arr[] = new int[n];
          int pre[] = new int[n];
          int ar[] = new int[101];
          for(int i=0;i<n;i++)
          {
              arr[i]=inp.nextInt();
              

          }
          pre[0]=arr[0];
          for(int i=1;i<n;i++)
          {
              pre[i]+=pre[i-1]+arr[i];
          }
          ans[0]=0;
          out1.print(0+" ");
          int cnt=0;
          ar[arr[0]]++;
          for(int i=1;i<n;i++)
          {
              int tem= m-pre[i];
              if(tem>=0)
              {
                  ans[i]=0;
                  out1.print(0+" ");
                  ar[arr[i]]++;
                  continue;
              }
              cnt=0;
            for(int j=100;j>=1;j--)
            {
                int x;
                if((-tem)%j==0)
                {
                    x=(-tem)/j;
                }
                else
                {
                    x=((-tem)/j)+1;
                }

                // out1.println(arr[i]+" "+j);
                if(ar[j]>=x)
                {
                    
                    cnt+=x;
                    ans[i]=cnt;
                    out1.print(cnt+" ");
                    break;
                }
                else
                {
                    tem+=ar[j]*j;
                    cnt+=ar[j];
                }
            }
            ar[arr[i]]++;
            // System.out.println(Arrays.toString(ar));
          }

        
           
        }
}





    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}
class ele{
    long value;
    long i;
    boolean flag;
    public ele(long value,long i)
    {
        this.value = value;
        this.i=i;
        this.flag = false;
    }
}