uses crt;
const fi='ktt2.inp'
var f1:text;
s:string;
a:array[1..100]of integer;
n,i,x,dem,t,kt,kt1,j,max,kt2:integer;
begin
clrscr;
assign(f1,fi);reset(f1);
readln(f1,n,x);
readln(f1,s);
for i:=1 to n do
read(f1,a[i]);
t:=0;
for i:=1 to n do
if a[i]>1 then
begin
kt:=0;
for j:=2 to a[i]-1 do
if a[i] mod j=0 then kt:=1;
if kt=0 then t:=t+a[i];
end;
writeln('Tong cac so nguyen to la: ',t);
dem:=0;
for i:=1 to n do
if a[i]>1 then
begin
kt1:=0;
for j:=2 to a[i]-1 do
if a[i] mod j=0 then kt1:=1;
if (kt1=0) and (a[i]<x) then inc(dem);
end;
writeln('So luong so nguyen to nho hon ',x,' la: ',dem);
max:=0;
for i:=1 to n do
if a[i]>1 then
begin
kt2:=0;
for j:=2 to a[i]-1 do
if a[i] mod j=0 then kt2:=1;
if (kt2=0) and (max<a[i]) then max:=a[i];
end;
if max=0 then writeln('Khong co so nguyen to nao trong day')
else writeln('So nguyen to lon nhat la: ',max);
write('Xau ',s,' theo thu tu nguoc la: ');
d:=length(s);
for i:=d downto 1 do
write(s[i]);
writeln;
close(f1);
readln;
end.