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
#include<stdio.h>
#define aaa printf("a\n");
#define bbb printf("b\n");
#define ccc printf("c\n");
typedef unsigned long long int LLU;
typedef unsigned char UC;

 main()
{
	UC k;
	LLU n;
	scanf("%d%llu",&k,&n);
	UC*p=new UC[k];
	for(UC*w=p;w<p+k;w++)   scanf("%d",w);
    for(LLU i=n;;i--)
    {
        n=i;
        for(UC*w=p;w<p+k;w++)
            while(n%(*w)==0)    n/=*w;
        if(n==1)
        {
            printf("%llu",i);
            return 0;
        }
    }
	return 0;
}