#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = (1LL << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  vector<bool> good((1 << n), false);
  for (int i = 0; i < k; ++i) {
    int v;
    cin >> v;
    --v;
    good[v] = true;
  }
  vector<vector<int>> d(4, vector<int>(1 << (n - 1), -1));
  for (int i = 0; i < (1 << (n - 1)); ++i) {
    if (good[2 * i] && good[2 * i + 1]) {
      d[3][i] = 1;
    } else if (!good[2 * i] && !good[2 * i + 1]) {
      d[0][i] = 0;
    } else {
      d[1][i] = 1;
      d[2][i] = 1;
    }
  }
  for (int step = 0; step < n - 1; ++step) {
    vector<vector<int>> new_d(4, vector<int>(1 << (n - 2 - step), -1));
    for (int i = 0; i < (1 << (n - 2 - step)); ++i) {
      for (int j1 = 0; j1 < 4; ++j1) {
        if (d[j1][2 * i] == -1) {
          continue;
        }
        for (int j2 = 0; j2 < 4; ++j2) {
          if (d[j2][2 * i + 1] == -1) {
            continue;
          }
          if ((j1 | j2) == 3) {
            new_d[3][i] = max(new_d[3][i], d[j1][2 * i] + d[j2][2 * i + 1] + 3);
          } else if ((j1 | j2) == 2) {
            new_d[2][i] = max(new_d[2][i], d[j1][2 * i] + d[j2][2 * i + 1] + 2);
          } else if (j1 == 1 && j2 == 1) {
            new_d[3][i] = max(new_d[3][i], d[j1][2 * i] + d[j2][2 * i + 1] + 2);
          } else if (j1 == 1 || j2 == 1) {
            new_d[1][i] = max(new_d[1][i], d[j1][2 * i] + d[j2][2 * i + 1] + 1);
            new_d[2][i] = max(new_d[2][i], d[j1][2 * i] + d[j2][2 * i + 1] + 2);
          } else {
            new_d[0][i] = max(new_d[0][i], d[j1][2 * i] + d[j2][2 * i + 1]);
          }
        }
      }
    }
    d = new_d;
  }
  int res = d[0][0];
  for (int j = 1; j < 4; ++j) {
    if (d[j][0] != -1) {
      res = max(res, d[j][0] + 1);
    }
  }
  cout << res << "\n";
  return 0;
}
