uses crt;
var a:array[1..100]of integer;
n,k,t,i:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(n);
end;
for i:=n downto 1 do
write(a[i]:4);
writeln;
write('Nhap k='); readln(k);
t:=0;
for i:=1 to n do
if k mod a[i]=0 then t:=t+a[i];
writeln(t);
for i:=1 to n do
if a[i]=k then write(i:4);
readln;
end.