Link to this code: https://cses.fi/paste/52086d95520ac9c2286115/
/*
  author: @ankingcodes
  created: 2021-08-05 15:18:06.169631
*/
        
#include<bits/stdc++.h>
#include<algorithm>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define MOD 1000000007
#define INF 1e18

typedef tree<int, null_type, less<int>, rb_tree_tag,
                tree_order_statistics_node_update> PBDS;

typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,
                tree_order_statistics_node_update> pairPBDS;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n; cin >> n;
  int x; cin >> x;
  vector<int> arr(n), dp(x+1, 1e9);
  for (auto &i: arr) cin >> i;
  dp[0] = 0;
  for (int i=1;i<=x;i++) {
    for (auto a: arr) {
      if (i - a >= 0) {
        dp[i] = min(dp[i], dp[i-a]+1);
      }
    }
  }
  if (dp[x] == 1e9) cout << -1 << endl;
  else cout << dp[x] << endl;
  return 0;
}