#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define all(a) a.begin(), a.end()
using vi = vector<int>;

void solve() {
    int n, k;cin >> n >> k;
    vi a(n);
    for (int i = 0;i < n;i++) {
        cin >> a[i];
    }
    int sum = 0;
    priority_queue<int,vi,greater<int>>pq(all(a));
    int ans = 0;
    while (1) {
        int t = pq.top();
        pq.pop();
        pq.push(t * 2);
        if (sum + t > k) {
            break;
        }
        sum += t;
        ans++;
    }
    cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; i++) {
        //cout << "----Test " << i << "----" << endl;
        solve();
    }
    return 0;
}

优先队列最小堆模拟