#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 value_type>
struct quick_heap {
    int sz;
    int head;
    int capacity;
    vector<int> pivots;
    value_type *values;
    quick_heap(int n) {
        values = (value_type*)malloc((n + 1) * sizeof(value_type));
        capacity = n + 1;
        head = 0;
        sz = 1;
        values[0] = 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 value_type &value) {
        int at = loc(sz);
        values[at] = value;
        for(int &i : pivots) {
            if(values[i] > 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];
        value_type m_value = values[m];
        value_type r_value = values[r];
        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 = get_median(0, r - 1);
            partition(loc(r - 1), p);
            iqs();
            //print();
        }
    }
 
    void partition(const int &r, const int &p) {
        value_type p_value;
        p_value = values[p];
        swap(values[p], values[r]);
        int at = head;
        int ptr = at;
        while(at != r) {
            if(values[at] < p_value or (values[at] == 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];
    }
 
    value_type pop() {
        if(head != pivots.back()) {
            iqs();
        }
        //print();
        sz--;
        head = nxt(head);
        pivots.pop_back();
        return values[prev(head)];
    }
	
	int size() const {
		return sz - 1;
	}
 
    void print() const {
        cout << "Current size: " << sz << endl;
        cout << "Values: ";
        for(int i = 0; i < sz; i++) cout << values[(head + i) % capacity] << " ";
        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> Q(n);
	for(int i = 0; i < n; i++) {
		long long x;
		cin >> x;
		Q.push(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(new_cookie);
		cnt += 1;
	}
	if(Q.top() < k) {
		cout << -1 << endl;
	}
	else {
		cout << cnt << endl;
	}
	return 0;
}