#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;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbiwgYVsxMDAwMV0sIHM7CmxvbmcgbG9uZyBmWzEwMDAwMDldOwoKaW50IG1haW4oKXsKICAgIGNpbiA+PiBuID4+IHM7CiAgICBmb3IoaW50IGkgPSAxOyBpIDw9IG47ICsraSkKICAgICAgICBjaW4gPj4gYVtpXTsKICAgIGZbMF0gPSAwOwogICAgZm9yKGludCBpID0gMTsgaSA8PSBzOyArK2kpewogICAgICAgIGZbaV0gPSBMTE9OR19NQVg7CiAgICAgICAgZm9yKGludCBqID0gMTsgaiA8PSBuOyArK2opewogICAgICAgICAgICBpbnQgeCA9IGkgLSBhW2pdOwogICAgICAgICAgICBpZih4ID49IDAgJiYgZlt4XSAhPSBMTE9OR19NQVgpewogICAgICAgICAgICAgICAgZltpXSA9IG1pbihmW3hdICsgMSwgZltpXSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBpZihmW3NdID09IExMT05HX01BWCkKICAgICAgICBjb3V0IDw8IC0xOwogICAgZWxzZQogICAgICAgIGNvdXQgPDwgZltzXTsKICAgIHJldHVybiAwOwp9Cg==