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
104
105
106
#include <algorithm>
#include <cstdio>
using namespace std;

using ull = unsigned long long;

const int MAX = 1000000;
int cnt;

unsigned int P[25];
int n;

struct uint128 {
  ull b;

  uint128(int x) {
    b = x;
  }

  bool operator<=(ull x) const {
    return b <= x;
  }

  bool operator>(ull x) const {
    return b > x;
  }

  uint128 operator*(unsigned long long x) const {
    uint128 res = 0;
    ull u = b >> 32;
    ull l = b & 0xffffffff;
    ull r = u * x + ((l * x) >> 32);
    if (r >> 32) {
      res.b = 1ll<<63;
    } else {
      res.b = b * x;
    }
    return res;
  }

  operator ull() const {
    return b;
  }

};

unsigned long long H[MAX];
int hsize;

void go() {
  H[hsize++] = -1;
  while (hsize) {
    auto t = -H[0];
    H[MAX-1-cnt++] = t;
    pop_heap(H, H + hsize);
    hsize--;
    for (int i = 1; i < n; i++){
      int r = P[i];
      auto y = (ull)t * r;
      if (y >= 1000000000ll) {
        break;
      }
      bool vis = false;
      for (int j = i + 1; j < n; j++) {
        if (y % P[j] == 0) {
          vis = true;
          break;
        }
      }
      if (!vis) {
        H[hsize++] = -y;
        push_heap(H, H + hsize);
      }
    }
  }
  copy_n(H+MAX-cnt, cnt, H);
  reverse(H, H+cnt);
}

int main() {
  ull k;
  scanf("%d %llu\n", &n, &k);
  for (int i=0; i<n; i++) {
    scanf("%u", P+i);
  }
  sort(P, P+n);
  go();
  ull res = 1;
  for (uint128 p1 = 1; p1 <= k; p1 = p1 * (ull)P[0]) {
    for (int p = 0; p < n; p++) {
      auto a = p1 * (ull)(p ? P[p] : 1);
      int j = cnt - 1;
      while (a * H[j/2] > k && j > 0) j /= 2;
      for (int i = 0; i <= j; i++) {
        while (i <= j && a * H[i] * H[j] > k) {
          j--;
        }
        if (i <= j) {
          res = max(res, ull(a) * H[i] * H[j]);
        }
      }
    }
  }
  printf("%lld\n", res);
  return 0;
}