//
// main.cpp
// 1142 2ed.
//
// Created by 27 on 2021/5/3.
//
#include <iostream>
using namespace std;
struct Node{
long long data,times;
Node(long long d = 0,long long t = 0):data(d),times(t){}
}node[100100];
long long n,k,low = 2,pos,cnt = 1,tmp,ind;
void quickSort(int low,int high);
int divide(int low,int high);
int main(int argc, const char * argv[]) {
scanf("%lld%lld",&k,&n);
for(int i = 1;i <= k;i++) scanf("%lld",&node[i].data);
pos = k + 1;
node[pos++] = node[1];
node[k + 1].times = 1;
node[0].data = 1;
while(cnt < n){
for(int i = low;i < pos;i++){
if(i == low){
tmp = node[i].data * node[node[i].times].data;
ind = i;
}
else{
if(tmp > node[i].data * node[node[i].times].data){
tmp = node[i].data * node[node[i].times].data;
ind = i;
}
else if(tmp == node[i].data * node[node[i].times].data) node[i].times++;
else if(i > k && node[i].times <= 1) break;
}
}
node[pos].data = tmp;
node[pos++].times = 1;
node[ind].times++;
cnt++;
if(ind <= k) low++;
while(node[low].times > k) low++;
}
printf("%lld",node[pos - 1].data);
return 0;
}
void quickSort(int low,int high)
{
if(low >= high) return;
int mid = divide(low,high);
quickSort(mid + 1, high);
quickSort(low, mid - 1);
}
int divide(int low,int high)
{
Node k = node[low];
do{
while(low < high && node[high].data >= k.data) high--;
if(low < high) node[low++] = node[high];
while(low < high && node[low].data <= k.data) low++;
if(low < high) node[high--] = node[low];
}while(low != high);
node[low] = k;
return low;
}