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
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <iostream>

typedef int64_t int64;

int64 solve(const std::vector<int>& c, int start, int64 max) {
  int64 result = 1;
  for (int i = start; i < c.size(); i++) {
    int64 ci = c[i];
    if (ci > max) {
      break;
    }
    result = std::max(result, ci * solve(c, i, max / ci));
  }
  return result;
}

int main(int argc, char **argv) {
  int count;
  int64 max;
  std::cin >> count >> max;
  std::vector<int> c(count);
  for (int i = 0; i < count; i++) {
    std::cin >> c[i];
  }
  std::sort(c.begin(), c.end());
  std::cout << solve(c, 0, max) << "\n";
  return 0;
}