#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-9;
const int INF = 1E9;
const int MAXN = 128;
int n, x;
double p[MAXN], a[MAXN][MAXN], b[MAXN][MAXN], v[MAXN], w[MAXN];
int main() {
  cin >> n >> x;
  for (int i = 0; i < (int)(x + 1); i++) cin >> p[i];
  memset(v, 0, sizeof(v));
  v[0] = 1;
  for (int i = 0; i < (int)(MAXN); i++)
    for (int j = 0; j < (int)(MAXN); j++) a[i][j] = p[j ^ i];
  while (n > 0) {
    if (n & 1) {
      for (int i = 0; i < (int)(MAXN); i++) w[i] = v[i];
      for (int i = 0; i < (int)(MAXN); i++) {
        v[i] = 0;
        for (int j = 0; j < (int)(MAXN); j++) v[i] += a[i][j] * w[j];
      }
    }
    for (int i = 0; i < (int)(MAXN); i++)
      for (int j = 0; j < (int)(MAXN); j++) b[i][j] = a[i][j];
    for (int i = 0; i < (int)(MAXN); i++)
      for (int j = 0; j < (int)(MAXN); j++) {
        a[i][j] = 0;
        for (int k = 0; k < (int)(MAXN); k++) a[i][j] += b[i][k] * b[k][j];
      }
    n >>= 1;
  }
  cout.precision(20);
  cout << (double)1.0 - v[0] << '\n';
  return 0;
}
