#include<bits/stdc++.h>
using namespace std;
int n, t, dp[1000005], c[1005];
const int mod = 1e9 + 7;
int main() {
cin >> t >> n;
for (int i = 1; i <= t; i++)
cin >> c[i];
/// if (n == 0) return 1
/// TH co so
/// 1, 2, 3, 4, 5, 6
/// c[1], c[2], ...., c[t]
dp[0] = 0;
for (int i = 1; i <= n; i++) {
dp[i] = 10000000;
for (int j = 1; j <= t; j++)
if (i - c[j] >= 0) {
/// tren tay 230k
/// c[j] = 50k
/// tay cua a co 1 to tien va con lai (230 - 50)k
dp[i] = min(dp[i], dp[i - c[j]] + 1);
}
}
if (dp[n] == 10000000) cout << -1;
else
cout << dp[n];
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbiwgdCwgZHBbMTAwMDAwNV0sIGNbMTAwNV07Cgpjb25zdCBpbnQgbW9kID0gMWU5ICsgNzsKCmludCBtYWluKCkgewogICAgY2luID4+IHQgPj4gbjsKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IHQ7IGkrKykKICAgICAgICBjaW4gPj4gY1tpXTsKICAgIC8vLyBpZiAobiA9PSAwKSByZXR1cm4gMQogICAgLy8vIFRIIGNvIHNvCiAgICAvLy8gMSwgMiwgMywgNCwgNSwgNgoKICAgIC8vLyBjWzFdLCBjWzJdLCAuLi4uLCBjW3RdCgogICAgZHBbMF0gPSAwOwoKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG47IGkrKykgewogICAgICAgIGRwW2ldID0gMTAwMDAwMDA7CgogICAgICAgIGZvciAoaW50IGogPSAxOyBqIDw9IHQ7IGorKykKICAgICAgICAgICAgaWYgKGkgLSBjW2pdID49IDApIHsKICAgICAgICAgICAgICAgIC8vLyB0cmVuIHRheSAyMzBrCiAgICAgICAgICAgICAgICAvLy8gY1tqXSA9IDUwawogICAgICAgICAgICAgICAgLy8vIHRheSBjdWEgYSBjbyAxIHRvIHRpZW4gdmEgY29uIGxhaSAoMjMwIC0gNTApawogICAgICAgICAgICAgICAgZHBbaV0gPSBtaW4oZHBbaV0sIGRwW2kgLSBjW2pdXSArIDEpOwogICAgICAgICAgICB9CiAgICB9CiAgICBpZiAoZHBbbl0gPT0gMTAwMDAwMDApIGNvdXQgPDwgLTE7CiAgICBlbHNlCiAgICBjb3V0IDw8IGRwW25dOwoKfQoK