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
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
#include<bits/stdc++.h>
using namespace std;
# ifdef DEB
# define debug(...) fprintf(stderr, __VA_ARGS__)
# else
# define debug(...)
#endif
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define LL long long
#define LD long double
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define pb pop_back
#define VI vector<int>
#define VPI vector<PII>
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define FORD(i,a,b) for(int i = (a); i >= (b); i--)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define ALL(x) (x).begin(), (x).end()
#define siz(V) ((int)V.size())
const LL inf = 3.5e8;
const int M = 1.8e6;

vector<int> P;
int V[M];
LL res = 1, n, k, inf2, r;
int len = 0;

void generate1(LL x, int ind)
{
  if (ind >= siz(P))
  {
    V[len++] = x;
    return;
  }
  while (x <= inf)
  {
    generate1(x, ind + 1);
    x *= P[ind];
  }
}

void check(LL x)
{
  int st = 0, en = len - 1, mid = (st + en) / 2;
  while (st <= en)
  {
    if (x <= k / V[mid])
    {
      res = max(res, x * V[mid]);
      st = mid + 1;
    }
    else
    {
      en = mid - 1;
    }
    mid = (st + en) / 2;
  }
}

void generate2(LL x, int ind, int mini)
{
  if (ind >= siz(P))
  {
    if (x >= inf2 - 1000)
    {
      check(x);
    }
    return;
  }
  generate2(x, ind + 1, mini);
  mini = min(mini, P[ind]);
  x *= P[ind];
  while (x <= inf2 * mini)
  {
    generate2(x, ind + 1, mini);
    x *= P[ind];
  }
}

int main()
{
  //ios_base::sync_with_stdio(0);
  scanf("%lld%lld", &n, &k);
  for (int i = 0; i < n; i++)
  {
    LL a;
    scanf("%lld", &a);
    P.PB(a);
  }
  sort(ALL(P));
  reverse(ALL(P));
  generate1(1, 0);
  sort(V, V + len);
  inf2 = max(1LL, (k + inf - 1) / inf);
  generate2(1, 0, inf);
  printf("%lld\n", res);
  return 0;
}