#include <bits/stdc++.h>
using namespace std;
struct mat {
  double a[130];
};
int n, x;
mat mul(mat a, mat b) {
  mat c;
  memset(c.a, 0, sizeof(c.a));
  for (int i = 0; i < 128; i++)
    for (int j = 0; j < 128; j++) c.a[i ^ j] += a.a[i] * b.a[j];
  return c;
}
int main() {
  mat a;
  memset(a.a, 0, sizeof(a.a));
  cin >> n >> x;
  for (int i = 0; i <= x; i++) cin >> a.a[i];
  mat ans;
  memset(ans.a, 0, sizeof(ans.a));
  ans.a[0] = 1;
  while (n) {
    if (n % 2) ans = mul(ans, a);
    n /= 2;
    a = mul(a, a);
  }
  printf("%.8lf\n", 1 - ans.a[0]);
}
