#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, long long *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  freopen("nsq.in", "r", stdin);
  freopen("nsq.out", "w+", stdout);
  long long i, n, p, a[100010];
  scanf("%I64d %I64d", &n, &p);
  double av = 0, tt = 1.0 / n;
  for (i = 0; i < n; i++) {
    scanf("%I64d", &a[i]);
    tt *= a[i];
  }
  for (i = 0; i < n; i++) {
    av += (tt * 1.0 / a[i]);
    if (av > p)
      av -= p;
  }
  printf("%.10lf", av);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc3590,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
lea    0xeaf(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <freopen@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edx
lea    0xe9c(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1040 <freopen@plt>
lea    0xe94(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc3588(%rbp)
ff
cvtsi2sdq -0x20(%rbp),%xmm1
movsd  0xe50(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xc3590(%rbp)
ff
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1221 <main+0xf1>
mov    -0x18(%rbp),%rax
lea    -0xc3580(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rax
cvtsi2sdq -0xc3580(%rbp,%rax,8),%xmm0
ca f3 ff
mulsd  -0xc3590(%rbp),%xmm0
ff
movsd  %xmm0,-0xc3590(%rbp)
ff
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11c4 <main+0x94>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    12b1 <main+0x181>
movsd  0xdc1(%rip),%xmm0
mulsd  -0xc3590(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rax
cvtsi2sdq -0xc3580(%rbp,%rax,8),%xmm1
ca f3 ff
divsd  %xmm1,%xmm0
addsd  -0xc3588(%rbp),%xmm0
ff
movsd  %xmm0,-0xc3588(%rbp)
ff
movsd  -0xc3588(%rbp),%xmm0
ff
cvtsi2sdq -0x28(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    129b <main+0x16b>
cvtsi2sdq -0x28(%rbp),%xmm1
movsd  -0xc3588(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xc3588(%rbp)
ff
jmp    12a0 <main+0x170>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1229 <main+0xf9>
movsd  -0xc3588(%rbp),%xmm0
ff
lea    0xd68(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc3590,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xc3570,%rsp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edx
lea    0xebc(%rip),%rdi
lea    0xebc(%rip),%rsi
call   1040 <freopen@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edx
lea    0xea9(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   1040 <freopen@plt>
lea    0xea1(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x18(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%rax
xorpd  %xmm0,%xmm0
test   %rax,%rax
jle    12ae <main+0x17e>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0xe52(%rip),%xmm5
divsd  %xmm0,%xmm5
lea    0xe69(%rip),%r14
xor    %r15d,%r15d
xor    %ebx,%ebx
xchg   %ax,%ax
movsd  %xmm5,0x10(%rsp)
lea    (%rsp,%r15,1),%rsi
add    $0x20,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x10(%rsp),%xmm5
xorps  %xmm0,%xmm0
cvtsi2sdq 0x20(%rsp,%rbx,8),%xmm0
mulsd  %xmm0,%xmm5
add    $0x1,%rbx
mov    0x8(%rsp),%rax
add    $0x8,%r15
cmp    %rax,%rbx
jl     11c0 <main+0x90>
test   %rax,%rax
xorpd  %xmm0,%xmm0
jle    12ae <main+0x17e>
cvtsi2sdq 0x18(%rsp),%xmm4
cmp    $0x1,%rax
jne    1220 <main+0xf0>
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
jmp    1287 <main+0x157>
mov    %rax,%rdx
and    $0xfffffffffffffffe,%rdx
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
nopl   (%rax)
xorps  %xmm1,%xmm1
cvtsi2sdq 0x20(%rsp,%rcx,8),%xmm1
movapd %xmm5,%xmm2
divsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movapd %xmm4,%xmm1
cmpltsd %xmm2,%xmm1
andpd  %xmm4,%xmm1
xorps  %xmm3,%xmm3
cvtsi2sdq 0x28(%rsp,%rcx,8),%xmm3
subsd  %xmm1,%xmm2
movapd %xmm5,%xmm0
divsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
movapd %xmm4,%xmm1
cmpltsd %xmm0,%xmm1
andpd  %xmm4,%xmm1
subsd  %xmm1,%xmm0
add    $0x2,%rcx
cmp    %rcx,%rdx
jne    1230 <main+0x100>
test   $0x1,%al
je     12ae <main+0x17e>
xorps  %xmm1,%xmm1
cvtsi2sdq 0x20(%rsp,%rcx,8),%xmm1
divsd  %xmm1,%xmm5
addsd  %xmm5,%xmm0
movapd %xmm4,%xmm1
cmpltsd %xmm0,%xmm1
andpd  %xmm4,%xmm1
subsd  %xmm1,%xmm0
lea    0xd73(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc3570,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"nsq.in\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [8 x i8] c"nsq.out\00"
@.str.3 = [3 x i8] c"w+\00"
@stdout = global i32 0
@.str.4 = [12 x i8] c"%I64d %I64d\00"
@.str.5 = [6 x i8] c"%I64d\00"
@.str.6 = [7 x i8] c"%.10lf\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca [100010 x i64]
%10 = alloca double
%11 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* @stdin
%13 = call i32 @freopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @stdout
%15 = call i32 @freopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64* %7, i64* %8)
store double 0.000000e+00, double* %10
%17 = load i64, i64* %7
%18 = sitofp i64 %17 to double
%19 = fdiv double 1.000000e+00, %18
store double %19, double* %11
store i64 0, i64* %6
br label %20
20: ; preds = %34, %2
%21 = load i64, i64* %6
%22 = load i64, i64* %7
%23 = icmp slt i64 %21, %22
br i1 %23, label %24, label %37
24: ; preds = %20
%25 = load i64, i64* %6
%26 = getelementptr inbounds [100010 x i64], [100010 x i64]* %9, i64 0, i64 %25
%27 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64* %26)
%28 = load i64, i64* %6
%29 = getelementptr inbounds [100010 x i64], [100010 x i64]* %9, i64 0, i64 %28
%30 = load i64, i64* %29
%31 = sitofp i64 %30 to double
%32 = load double, double* %11
%33 = fmul double %32, %31
store double %33, double* %11
br label %34
34: ; preds = %24
%35 = load i64, i64* %6
%36 = add nsw i64 %35, 1
store i64 %36, i64* %6
br label %20
37: ; preds = %20
store i64 0, i64* %6
br label %38
38: ; preds = %62, %37
%39 = load i64, i64* %6
%40 = load i64, i64* %7
%41 = icmp slt i64 %39, %40
br i1 %41, label %42, label %65
42: ; preds = %38
%43 = load double, double* %11
%44 = fmul double %43, 1.000000e+00
%45 = load i64, i64* %6
%46 = getelementptr inbounds [100010 x i64], [100010 x i64]* %9, i64 0, i64 %45
%47 = load i64, i64* %46
%48 = sitofp i64 %47 to double
%49 = fdiv double %44, %48
%50 = load double, double* %10
%51 = fadd double %50, %49
store double %51, double* %10
%52 = load double, double* %10
%53 = load i64, i64* %8
%54 = sitofp i64 %53 to double
%55 = fcmp ogt double %52, %54
br i1 %55, label %56, label %61
56: ; preds = %42
%57 = load i64, i64* %8
%58 = sitofp i64 %57 to double
%59 = load double, double* %10
%60 = fsub double %59, %58
store double %60, double* %10
br label %61
61: ; preds = %56, %42
br label %62
62: ; preds = %61
%63 = load i64, i64* %6
%64 = add nsw i64 %63, 1
store i64 %64, i64* %6
br label %38
65: ; preds = %38
%66 = load double, double* %10
%67 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), double %66)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"nsq.in\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [8 x i8] c"nsq.out\00"
@.str.3 = [3 x i8] c"w+\00"
@stdout = global i32 0
@.str.4 = [12 x i8] c"%I64d %I64d\00"
@.str.5 = [6 x i8] c"%I64d\00"
@.str.6 = [7 x i8] c"%.10lf\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca [100010 x i64]
%6 = load i32, i32* @stdin
%7 = tail call i32 @freopen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stdout
%9 = tail call i32 @freopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = bitcast i64* %3 to i8*
%11 = bitcast i64* %4 to i8*
%12 = bitcast [100010 x i64]* %5 to i8*
%13 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64* %3, i64* %4)
%14 = load i64, i64* %3
%15 = icmp sgt i64 %14, 0
br i1 %15, label %16, label %77
16: ; preds = %2
%17 = sitofp i64 %14 to double
%18 = fdiv double 1.000000e+00, %17
br label %28
19: ; preds = %28
%20 = icmp sgt i64 %37, 0
br i1 %20, label %21, label %77
21: ; preds = %19
%22 = load i64, i64* %4
%23 = sitofp i64 %22 to double
%24 = and i64 %37, 1
%25 = icmp eq i64 %37, 1
br i1 %25, label %63, label %26
26: ; preds = %21
%27 = and i64 %37, -2
br label %39
28: ; preds = %16, %28
%29 = phi double [ %35, %28 ], [ %18, %16 ]
%30 = phi i64 [ %36, %28 ], [ 0, %16 ]
%31 = getelementptr inbounds [100010 x i64], [100010 x i64]* %5, i64 0, i64 %30
%32 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64* %31)
%33 = load i64, i64* %31
%34 = sitofp i64 %33 to double
%35 = fmul double %29, %34
%36 = add nuw nsw i64 %30, 1
%37 = load i64, i64* %3
%38 = icmp slt i64 %36, %37
br i1 %38, label %28, label %19
39: ; preds = %39, %26
%40 = phi double [ 0.000000e+00, %26 ], [ %59, %39 ]
%41 = phi i64 [ 0, %26 ], [ %60, %39 ]
%42 = phi i64 [ 0, %26 ], [ %61, %39 ]
%43 = getelementptr inbounds [100010 x i64], [100010 x i64]* %5, i64 0, i64 %41
%44 = load i64, i64* %43
%45 = sitofp i64 %44 to double
%46 = fdiv double %35, %45
%47 = fadd double %40, %46
%48 = fcmp ogt double %47, %23
%49 = select i1 %48, double %23, double 0.000000e+00
%50 = fsub double %47, %49
%51 = or i64 %41, 1
%52 = getelementptr inbounds [100010 x i64], [100010 x i64]* %5, i64 0, i64 %51
%53 = load i64, i64* %52
%54 = sitofp i64 %53 to double
%55 = fdiv double %35, %54
%56 = fadd double %50, %55
%57 = fcmp ogt double %56, %23
%58 = select i1 %57, double %23, double 0.000000e+00
%59 = fsub double %56, %58
%60 = add nuw nsw i64 %41, 2
%61 = add i64 %42, 2
%62 = icmp eq i64 %61, %27
br i1 %62, label %63, label %39
63: ; preds = %39, %21
%64 = phi double [ undef, %21 ], [ %59, %39 ]
%65 = phi double [ 0.000000e+00, %21 ], [ %59, %39 ]
%66 = phi i64 [ 0, %21 ], [ %60, %39 ]
%67 = icmp eq i64 %24, 0
br i1 %67, label %77, label %68
68: ; preds = %63
%69 = getelementptr inbounds [100010 x i64], [100010 x i64]* %5, i64 0, i64 %66
%70 = load i64, i64* %69
%71 = sitofp i64 %70 to double
%72 = fdiv double %35, %71
%73 = fadd double %65, %72
%74 = fcmp ogt double %73, %23
%75 = select i1 %74, double %23, double 0.000000e+00
%76 = fsub double %73, %75
br label %77
77: ; preds = %68, %63, %2, %19
%78 = phi double [ 0.000000e+00, %19 ], [ 0.000000e+00, %2 ], [ %64, %63 ], [ %76, %68 ]
%79 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), double %78)
ret i32 0
}