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

const int maxn = 100;
const int maxvalue = 1024;
int dp[maxvalue][maxn];

int main() {

    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    if (n == 1) {
        cout << (x % a[0] == 0 ? x / a[0] : -1);
        return 0;
    }

    for (int j = 0; j < maxvalue; j++)
        for (int i = 0; i < maxn; i++) dp[j][i] = INT_MAX;

    dp[x % maxvalue][0] = 0;
    for (int mj = x; mj > 0; mj--) {
        for (int i = 0; i < n; i++) {
            int j = mj % maxvalue;
            if (dp[j][i] == INT_MAX) continue;
            if (mj >= a[i]) {
                int ni = min(n - 1, i + 1);
                int nj = (mj - a[i]) % maxvalue;
                dp[nj][ni] = min(dp[nj][ni], dp[j][i] + 1);
            }
            if (mj >= a[0]) {
                int nj = (mj - a[0]) % maxvalue;
                dp[nj][1] = min(dp[nj][1], dp[j][i] + 2);
            }
            dp[j][i] = INT_MAX;
        }
    }

    int answer = INT_MAX;
    for (int i = 0; i < n; i++) answer = min(answer, dp[0][i]);
    cout << ((answer == INT_MAX) ? -1 : answer);
}
