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

int n, a[10001], s;
long long f[1000009];

int main(){
    cin >> n >> s;
    for(int i = 1; i <= n; ++i)
        cin >> a[i];
    f[0] = 0;
    for(int i = 1; i <= s; ++i){
        f[i] = LLONG_MAX;
        for(int j = 1; j <= n; ++j){
            int x = i - a[j];
            if(x >= 0 && f[x] != LLONG_MAX){
                f[i] = min(f[x] + 1, f[i]);
            }
        }
    }
    if(f[s] == LLONG_MAX)
        cout << -1;
    else
        cout << f[s];
    return 0;
}
