优先队列

#include <iostream>
#include<queue>
#include<vector>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;
    cin>>n>>k;
    priority_queue<int,vector<int>,greater<int>>heap;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        heap.push(a);
    }
    int total=0;
    int day=0;
    while(!heap.empty()){
        int t=heap.top();
        heap.pop();
        total+=t;
        if(total>k)break;
        day++;
        heap.push(2*t);
    }
    cout<<day<<endl;
    return 0;
}