#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using D = double;
using uint = unsigned int;
template <typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 17;
const int maxtsz = 1 << maxn;
const int inf = 1e9;
int tree[2 * maxtsz];
pair2<int> calc(int cur, int len) {
  if (len == 2) {
    if (tree[cur] == 0) return {-inf, 0};
    return {1, 1};
  }
  if (tree[cur] == 0) return {-inf, 0};
  auto rl = calc(cur * 2, len / 2);
  auto rr = calc(cur * 2 + 1, len / 2);
  if (tree[cur] == 1)
    return {max(rl.first, rr.first) + 1, max(rl.second, rr.second) + 2};
  auto res = make_pair(0, 0);
  res.first = max(rl.first + max(rr.first, rr.second),
                  max(rl.first, rl.second) + rr.first) +
              3;
  res.second = rr.second + rl.second + 2;
  return res;
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  if (k == 0) {
    cout << 0 << endl;
    return 0;
  }
  int treesize = 1 << n;
  for (int i = 0; i < k; i++) {
    int x;
    scanf("%d", &x);
    x--;
    tree[treesize + x] = 1;
  }
  for (int i = treesize - 1; i > 0; i--) {
    tree[i] = tree[2 * i] + tree[2 * i + 1];
  }
  auto answer = calc(1, (1 << n));
  int res = max(answer.first, answer.second) + 1;
  cout << res << endl;
  return 0;
}
