#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int dp[17][1 << 16][2][2];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 0; i < 17; i++) {
    for (int j = 0; j < (1 << 16); j++) {
      for (int k = 0; k < 2; k++) {
        for (int l = 0; l < 2; l++) {
          dp[i][j][k][l] = -inf;
        }
      }
    }
  }
  int n, k;
  cin >> n >> k;
  vector<int> good(1 << n);
  while (k--) {
    int x;
    cin >> x;
    x--;
    good[x] = true;
  }
  for (int i = 0; i < (1 << n); i += 2) {
    dp[0][i / 2][good[i]][good[i + 1]] =
        max(dp[0][i / 2][good[i]][good[i + 1]], good[i] | good[i + 1]);
    dp[0][i / 2][good[i + 1]][good[i]] =
        max(dp[0][i / 2][good[i + 1]][good[i]], good[i] | good[i + 1]);
  }
  for (int l = 0; l + 1 < n; l++) {
    int p = (1 << n) / (1 << (l + 1));
    for (int i = 0; i < p; i += 2) {
      for (int u1 = 0; u1 < 2; u1++) {
        for (int d1 = 0; d1 < 2; d1++) {
          for (int u2 = 0; u2 < 2; u2++) {
            for (int d2 = 0; d2 < 2; d2++) {
              int d = (d1 | d2);
              if (d) {
                int u = u1 | u2;
                int m = 2 + u;
                dp[l + 1][i / 2][u][d] =
                    max(dp[l + 1][i / 2][u][d],
                        dp[l][i][u1][d1] + dp[l][i + 1][u2][d2] + m);
              } else {
                if (u1 & u2) {
                  dp[l + 1][i / 2][1][1] =
                      max(dp[l + 1][i / 2][1][1],
                          dp[l][i][u1][d1] + dp[l][i + 1][u2][d2] + 2);
                } else if (u1 | u2) {
                  dp[l + 1][i / 2][1][0] =
                      max(dp[l + 1][i / 2][1][0],
                          dp[l][i][u1][d1] + dp[l][i + 1][u2][d2] + 1);
                  dp[l + 1][i / 2][0][1] =
                      max(dp[l + 1][i / 2][0][1],
                          dp[l][i][u1][d1] + dp[l][i + 1][u2][d2] + 2);
                } else {
                  dp[l + 1][i / 2][0][0] =
                      max(dp[l + 1][i / 2][0][0],
                          dp[l][i][u1][d1] + dp[l][i + 1][u2][d2]);
                }
              }
            }
          }
        }
      }
    }
  }
  int ans = 0;
  for (int u = 0; u < 2; u++) {
    for (int d = 0; d < 2; d++) {
      ans = max(ans, dp[n - 1][0][u][d] + (u | d));
    }
  }
  cout << ans << endl;
  return 0;
}
