1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll k, N;
vector<ll> Pr;

ll biggest(int pos, ll acc) {
  if (pos == Pr.size()) return acc;
  
  ll result = 1;
  for (;acc <= N && acc > 0; acc*= Pr[pos])
    result = max(result, biggest(pos+1, acc));
  return result;
}

int main() {
  ios_base::sync_with_stdio(0);
  
  cin >> k >> N;

  int x;
  for (int i = 0; i < k; ++i) {
    cin >> x;
    Pr.push_back(x);
  }
    
  sort(Pr.rbegin(), Pr.rend());
  
  cout << biggest(0, 1) << endl;
  
  return 0;
}