/*
    OBI 2026 - Fase 2
    Cabo de Guerra
    Solução marc: usa vetor de frequência de 0 a 1000 para marcar
    quantas vezes cada valor aparece, depois encontra os 3 maiores e testa.
    
    Como 100 <= A_i <= 1000, usamos um vetor de frequência de tamanho 1001.
    
    Complexidade: O(N + MAX_A)
*/

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n, x;
    cin >> n >> x;

    vector<int> freq(1001, 0);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        freq[a]++;
    }

    // Encontra os 3 maiores valores (com repetição)
    vector<int> top;
    for (int v = 1000; v >= 100 && (int)top.size() < 3; v--) {
        int cnt = min(freq[v], 3 - (int)top.size());
        for (int j = 0; j < cnt; j++) {
            top.push_back(v);
        }
    }

    // Testa resposta 1
    if (top[0] >= x) {
        cout << 1 << "\n";
        return 0;
    }

    // Testa resposta 2
    if (top[0] + top[1] - 10 >= x) {
        cout << 2 << "\n";
        return 0;
    }

    // Testa resposta 3
    if (top[0] + top[1] + top[2] - 20 >= x) {
        cout << 3 << "\n";
        return 0;
    }

    cout << -1 << "\n";
    return 0;
}
