/*
ID: niepeng1
LANG: C++
TASK:humble
*/
/*
For a given set of K prime numbers S = {p1, p2, ..., pK}, consider the set of all numbers whose prime factors are a subset of S. This set contains, for example, p1, p1p2, p1p1, and p1p2p3 (among others). This is the set of `humble numbers' for the input set S. Note: The number 1 is explicitly declared not to be a humble number.
Your job is to find the Nth humble number for a given set S. Long integers (signed 32-bit) will be adequate for all solutions.
*/
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#define Max1 100010
#define MaxK 110
using namespace std;
int prime[MaxK];
int pindex[MaxK]={0};
long int way[Max1];
int main()
{
FILE *in,*out;
in=fopen("humble.in","r");
out=fopen("humble.out","w");
int i,j,K,N,min,minindex;
fscanf(in,"%d %d",&K,&N);
for(i=0;i<K;i++)
fscanf(in,"%d",&prime[i]);
j=0;
way[j]=1;
while(j<=N)
{
min=0x7fffffff;
minindex=0;
for(i=0;i<K;i++)
{
while( double(way[pindex[i]])*prime[i] <= way[j])
{
pindex[i]++;
}
if(min>double(way[pindex[i]])*prime[i])
{
min=double(way[pindex[i]])*prime[i];
minindex=i;
}
}
pindex[minindex]++;
way[++j]=min;
}
fprintf(out,"%d/n",way[N]);
return 0;
}