#include <bits/stdc++.h>
using namespace std;
int n, a[10001], s, 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] = INT_MAX;
for(int j = 1; j <= n; ++j){
int x = i - a[j];
if(x == 0)
f[i] = 1;
else if(x > 0 && f[x] != 0){
f[i] = min(f[x] + 1, f[i]);
}
}
if(f[i] == INT_MAX)
f[i] = 0;
}
if(f[s] == 0)
cout << -1;
else
cout << f[s];
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbiwgYVsxMDAwMV0sIHMsIGZbMTAwMDAwOV07CgppbnQgbWFpbigpewogICAgY2luID4+IG4gPj4gczsKICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gbjsgKytpKQogICAgICAgIGNpbiA+PiBhW2ldOwogICAgZlswXSA9IDA7CiAgICBmb3IoaW50IGkgPSAxOyBpIDw9IHM7ICsraSl7CiAgICAgICAgZltpXSA9IElOVF9NQVg7CiAgICAgICAgZm9yKGludCBqID0gMTsgaiA8PSBuOyArK2opewogICAgICAgICAgICBpbnQgeCA9IGkgLSBhW2pdOwogICAgICAgICAgICBpZih4ID09IDApCiAgICAgICAgICAgICAgICBmW2ldID0gMTsKICAgICAgICAgICAgZWxzZSBpZih4ID4gMCAmJiBmW3hdICE9IDApewogICAgICAgICAgICAgICAgZltpXSA9IG1pbihmW3hdICsgMSwgZltpXSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgaWYoZltpXSA9PSBJTlRfTUFYKQogICAgICAgICAgICBmW2ldID0gMDsKICAgIH0KICAgIGlmKGZbc10gPT0gMCkKICAgICAgICBjb3V0IDw8IC0xOwogICAgZWxzZQogICAgICAgIGNvdXQgPDwgZltzXTsKICAgIHJldHVybiAwOwp9