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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define repLL(i,a,b) for(LL i=(LL)a;i<(LL)b;i++)
#define perLL(i,a,b) for(LL i=(LL)a;i>(LL)b;i--)
#define debug5(a,b,c,d,e) cerr<<#a<<": "<<a<<" "<<#b<<": "<<b<<" "<<#c<<": "<<c<<" "<<#d<<": "<<d<<" "<<#e<<": "<<e<<endl;
#define debug4(a,b,c,d)  cerr<<#a<<": "<<a<<" "<<#b<<": "<<b<<" "<<#c<<": "<<c<<" "<<#d<<": "<<d<<endl;
#define debug3(a,b,c) cerr<<#a<<": "<<a<<" "<<#b<<": "<<b<<" "<<#c<<": "<<c<<endl;
#define debug2(a,b) cerr<<#a<<": "<<a<<" "<<#b<<": "<<b<<endl;
#define debug(a) cerr<<#a<<": "<<a<<endl;
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(),x.end()
#define fi first
#define se second
#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long double LD;
typedef pair<LD,LD> PLD;
typedef vector<LD> VLD;
typedef vector<PLD> VPLD;

const int maxn=(1e6)+7;
const int inf=(1e9)+7;
const LL LLinf=(1e18)+7;
const LD eps=1e-9;
const LL mod=1e9+7;

// ***************************** CODE ***************************** //

bitset<maxn> zb;
int odl[maxn];
VI P;
int tab[(int)1e5];
int numer;

inline bool czy(LL x)
{
      for(auto s:P)
            while(x%s==0)
                  x/=s;
      if(x==1LL)
            return 1LL;
      return 0LL;

}

LL rek(LL n,int kto)
{
      if(n<maxn)
            return n-odl[n];
      LL res=1LL;
      for(auto s:P)
            if(s>=kto)
                  res=max(res,rek(n/s,s)*s);
      return res;
}


int main()
{
      _upgrade
      int k;
      LL n;
      cin>>k>>n;
      rep(i,0,k)
      {
            int a;
            cin>>a;
            P.pb(a);
      }
      for(LL i=n;i>n-maxn;i--)
            if(czy(i))
            {
                  cout<<i<<endl;
                  return 0;
            }
      n-=maxn-1;
      LL res=1LL;
      int dlu=0;
      rep(i,1,maxn)
      {
            bool a=czy(i);
            zb[i]=a;
            if(a==0)
                  dlu++;
            else
                  dlu=0;
            odl[i]=dlu;
            if(zb[i])
                  tab[numer++]=i;
      }
      if(n<10000000000LL)
      {
            rep(i,0,numer)
            {
                  LL curr=n/(LL)tab[i];
                  if(curr<maxn)
                  {
                        curr-=odl[curr];
                        curr*=tab[i];
                        res=max(res,curr);
                  }
            }
            cout<<res<<endl;
            return 0;
      }
      res=max(res,rek(n,0LL));
      cout<<res<<endl;
      return 0;
}