#include <bits/stdc++.h>
using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int random(int l, int r) {
    return uniform_int_distribution<int>(l, r)(rng);
}
 
template<typename key_type, typename value_type>
struct quick_heap {
    int sz;
    int head;
    int capacity;
    vector<int> pivots;
    pair<key_type, value_type> *values;
    quick_heap(int n) {
        values = (pair<key_type, value_type>*)malloc((n + 1) * sizeof(pair<key_type, value_type>));
        capacity = n + 1;
        head = 0;
        sz = 1;
        values[0].second = numeric_limits<value_type>::max();
        pivots.emplace_back(0);
    }
 
    int nxt(int pos) const {
        return pos + 1 == capacity ? 0 : pos + 1;
    }
 
    int prev(int pos) const {
        return pos == 0 ? capacity - 1 : pos - 1;
    }
 
    int loc(int pos) const {
        return head + pos < capacity ? head + pos : head + pos - capacity;
    }
 
    void push(const key_type &key, const value_type &value) {
        int at = loc(sz);
        values[at].first = key;
        values[at].second = value;
        for(int &i : pivots) {
            if(values[i].second > value) {
                int to = nxt(i);
                if(at != to) {
                    swap(values[at], values[to]);
                }
                swap(values[i], values[to]);
                at = i;
                i = nxt(i);
            }
            else break;
        }
        sz += 1;
    }
 
    int get_first_size() const {
        return head <= pivots.back() ? pivots.back() - head : pivots.back() - head + capacity;
    }
 
    int get_median(int l, int r) {
        int m = loc(l + (r - l) / 2);
        l = loc(l); r = loc(r);
        value_type l_value = values[l].second;
        value_type m_value = values[m].second;
        value_type r_value = values[r].second;
        if(min(r_value, l_value) <= m_value and m_value <= max(r_value, l_value)) return m;
        if(min(m_value, r_value) <= l_value and l_value <= max(m_value, r_value)) return l;
        return r;
    }
 
    void iqs() {
        int r = get_first_size();
        if(r > 0) {
            int p = loc(random(0, r - 1));
            partition(loc(r - 1), p);
            iqs();
            //print();
        }
    }
 
    void partition(const int &r, const int &p) {
        key_type p_key;
        value_type p_value;
        tie(p_key, p_value) = values[p];
        swap(values[p], values[r]);
        int at = head;
        int ptr = at;
        while(at != r) {
            if(values[at].second < p_value or (values[at].second == p_value and at < p)) {
                if(ptr != at) {
                    swap(values[ptr], values[at]);
                }
                ptr = nxt(ptr);
            }
            at = nxt(at);
        }
        if(ptr != at) {
            swap(values[ptr], values[at]);
        }
        //cout << "New pivot: " << ptr << endl;
        pivots.emplace_back(ptr);
    }
 
    value_type top() {
        if(head != pivots.back()) {
            iqs();
        }
        return values[head].second;
    }
 
    key_type argmin() {
        if(head != pivots.back()) {
            iqs();
        }
        return values[head].first;
    }
 
    value_type pop() {
        if(head != pivots.back()) {
            iqs();
        }
        //print();
        sz--;
        head = nxt(head);
        pivots.pop_back();
        return values[prev(head)].second;
    }
	
	int size() const {
		return sz - 1;
	}
 
    void print() const {
        cout << "Current size: " << sz << endl;
        cout << "Keys: ";
        for(int i = 0; i < sz; i++) cout << values[(head + i) % capacity].first << " ";
        cout << endl;
        cout << "Values: ";
        for(int i = 0; i < sz; i++) cout << values[(head + i) % capacity].second << " ";
        cout << endl;
        cout << "Head: " << head << endl;
        cout << "Pivots" << endl;
        for(int i : pivots) {
            cout << i << " ";
        }
        cout << endl;
    }
};

int main() {
	cin.tie(0) -> sync_with_stdio(false);
	int n;
	long long k;
	cin >> n >> k;
	quick_heap<long long, long long> Q(n);
	for(int i = 0; i < n; i++) {
		long long x;
		cin >> x;
		Q.push(0, x);
	}
	int cnt = 0;
	while(Q.size() >= 2 and Q.top() < k) {
		long long least = Q.top(); Q.pop();
		long long second_least = Q.top(); Q.pop();
		long long new_cookie = least + (second_least << 1);
		Q.push(0, new_cookie);
		cnt += 1;
	}
	if(Q.top() < k) {
		cout << -1 << endl;
	}
	else {
		cout << cnt << endl;
	}
	return 0;
}