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
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<VI> VVI;
typedef pair<int, int> PII;

// #define int LL

#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FORE(i, x) for (__typeof((x).begin()) i = (x).begin(); i != (x).end(); ++i)

template <typename T> void _debug(const char *msg, T t) {
  cerr << msg << "="<< t << "\n";
}

template <typename T, typename... R> void _debug(const char *msg, T t, R... r) {
  while(*msg != ',') cerr << *msg++;
  cerr << "=" << t << ", ";
  _debug(msg+1, r...);
}

#ifdef TEST_ON_LOCAL_MACHINE
#define LOCAL
#endif

#ifdef LOCAL
#define debug(...) _debug(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) { cerr << #x << " = "; FORE(itt, x) cerr << *itt << ", "; cerr << "\n"; }
#define INIT() ios_base::sync_with_stdio(0); cin.tie(0);
#else
#define debug(...)
#define debugv(x)
#define INIT() ios_base::sync_with_stdio(0);
#endif

// as windows doesn't have thread unsafe version of puchar and getchar define
// to use thread save variants
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
#define getchar_unlocked() getchar()
#define putchar_unlocked(a) putchar(a)
#endif

template<class T = int64_t>
inline T readInt(){
  T ret;
  char tmp;
  int sign = 1;
  tmp = getchar_unlocked();
  if(tmp == '-') ret = (getchar_unlocked() - '0'), sign = -1;
  else ret = tmp -'0';
  while(tmp = getchar_unlocked(), tmp >= '0' && tmp <='9'){
    ret *= 10;
    ret += tmp - '0';
  }
  return ret*sign;
}

template<class T, short charsCount = short(std::log10(std::numeric_limits<T>::max())+2)>
inline void putInt(T arg){
  if(arg < 0) putchar_unlocked('-'), arg *= -1;
  char chars[charsCount];
  int digits = 0;
  do {
    chars[digits++] = (arg%10) + '0';
    arg /= 10;
  } while(arg);
  while(digits) putchar_unlocked(chars[--digits]);
}

vector<int> primes;

ULL getBest(ULL n) {
  if(n == 1) return 1;
  if(n == 0) return 0;
  ULL best = 1;
  for(const auto &i : primes){
    ULL tmp = getBest(n/i)*i;
    if(tmp > best) best = tmp;
  }
  return best;
}

int main(){
  ULL k ,n, tmp;
  cin >> k >> n;
  for(int i = 0; i < k; ++i){
    cin >> tmp;
    primes.push_back(tmp);
  }
  cout << getBest(n);
}