#include <bits/stdc++.h>
using namespace std;
int dp[70000][18][4];
int initial[140000];
vector<pair<int, int> > trans[4][4];
void pre() {
  trans[0][0] = {{0, 0}};
  trans[0][1] = {{1, 1}, {2, 2}};
  trans[0][2] = {{2, 2}};
  trans[0][3] = {{3, 3}, {2, 3}};
  trans[1][1] = {{3, 2}};
  trans[1][2] = {{3, 3}, {2, 3}};
  trans[1][3] = {{3, 3}};
  trans[2][2] = {{2, 2}};
  trans[2][3] = {{3, 3}, {2, 3}};
  trans[3][3] = {{3, 3}};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  pre();
  memset(dp, -1, sizeof dp);
  memset(initial, 0, sizeof initial);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    int t;
    cin >> t;
    t--;
    initial[t] = 1;
  }
  for (int i = 0; i < 1 << (n - 1); i++) {
    int ct = initial[2 * i] + initial[2 * i + 1];
    if (ct == 0) dp[i][0][0] = 0;
    if (ct == 1) {
      dp[i][0][1] = 1;
      dp[i][0][2] = 1;
    }
    if (ct == 2) dp[i][0][3] = 1;
  }
  int curr = 1 << (n - 2);
  int i = 0;
  while (curr > 0) {
    for (int j = 0; j < curr; j++) {
      for (int k = 0; k < 4; k++) {
        if (dp[2 * j][i][k] == -1) continue;
        for (int q = 0; q < 4; q++) {
          if (dp[2 * j + 1][i][q] == -1) continue;
          int l = min(k, q);
          int r = max(k, q);
          for (auto p : trans[l][r]) {
            int v1 = dp[2 * j][i][k];
            int v2 = dp[2 * j + 1][i][q];
            dp[j][i + 1][p.first] =
                max(dp[j][i + 1][p.first], v1 + v2 + p.second);
          }
        }
      }
    }
    curr >>= 1;
    i++;
  }
  cout << max({dp[0][n - 1][0], dp[0][n - 1][1] + 1, dp[0][n - 1][2] + 1,
               dp[0][n - 1][3] + 1})
       << '\n';
  ;
}
