#include <bits/stdc++.h>
using namespace std;
typedef long long arr[107];
typedef vector<long long> graph[107];
typedef pair<long long, long long> parr[107];
typedef long long table[107][100007];
typedef long long arr2[100007];
struct pp {
  long long a, b;
  bool operator<(const pp& V) const {
    if (a == V.a) return b < V.b;
    return a < V.a;
  }
  bool operator==(const pp& V) const {
    if (a == V.a && b == V.b) return 1;
    return 0;
  }
};
long long n, k;
arr A;
long long D[100007];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> A[i];
  D[0] = 1;
  sort(A + 1, A + 1 + n);
  for (int i = 1; i <= k; i++) {
    D[i] = 2;
    for (int j = 1; j <= n; j++) {
      if (A[j] > i) {
        break;
      }
      if (A[j] == i) D[i] = 1;
      D[i] = min(3 - D[i - A[j]], D[i]);
    }
  }
  cout << D[k] << endl;
}
