#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i, p, q) for (int i = p; i < q; i++)
ll dp[1000003];
long long solve(int n, int sum, int *ar) {
if (sum == 0) return 0;
if (dp[sum] != INT_MAX) return dp[sum];
// long long ans = 10000000;
long long ans = INT_MAX;
for (int i = 0; i < n; i++) {
if (sum - ar[i] >= 0) {
ans = min(ans, 1 + solve(n, sum - ar[i], ar));
}
}
dp[sum] = ans;
return ans;
}
int main()
{
int n,m;
cin >> n>>m;
int ar[n];
f(i,0,n)cin>>ar[i];
f(i,0,1000003)dp[i]= INT_MAX;
int a =solve(n,m, ar);
cout<< ((a== 10000000)? -1 : a);
}