#include <bits/stdc++.h>
using namespace std;
const int maxn = (1 << 17) + 5;
int dp[18][maxn][2][2];
int n, k, a[maxn], vis[maxn];
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= k; i++) scanf("%d", &a[i]), vis[a[i] - 1] = 1;
  for (int i = 0; i <= (1 << n - 1) - 1; i++) {
    dp[n - 1][i][0][vis[i << 1] | vis[i << 1 | 1]] = 1;
    dp[n - 1][i][vis[i << 1] | vis[i << 1 | 1]][0] = 1;
    dp[n - 1][i][vis[i << 1] & vis[i << 1 | 1]][vis[i << 1] & vis[i << 1 | 1]] =
        1;
    if (!vis[i << 1] && !vis[i << 1 | 1]) dp[n - 1][i][0][0] = 0;
  }
  for (int i = n - 2; i >= 0; i--) {
    int all = (1 << i) - 1;
    for (int j = 0; j <= all; j++)
      for (int a1 = 0; a1 <= 1; a1++)
        for (int b1 = 0; b1 <= 1; b1++)
          for (int a2 = 0; a2 <= 1; a2++)
            for (int b2 = 0; b2 <= 1; b2++) {
              if (dp[i + 1][j << 1][a1][b1] == -1 ||
                  dp[i + 1][j << 1 | 1][a2][b2] == -1)
                continue;
              int tmp =
                  dp[i + 1][j << 1][a1][b1] + dp[i + 1][j << 1 | 1][a2][b2];
              int up = a1 + a2, down = b1 | b2;
              dp[i][j][up > 0][down] =
                  max(dp[i][j][up > 0][down], tmp + down * 2 + (up > 0));
              if (up)
                dp[i][j][up - 1][1] =
                    max(dp[i][j][up - 1][1], tmp + down + 1 + (up > 0));
            }
  }
  int ans = 0;
  for (int a1 = 0; a1 <= 1; a1++)
    for (int b1 = 0; b1 <= 1; b1++)
      ans = max(ans, dp[0][0][a1][b1] + (a1 + b1 > 0));
  printf("%d\n", ans);
}
