#include <bits/stdc++.h>
using namespace std;
const int N = 18;
int n, k, x, ans;
int w[1 << N], dp[N][1 << N][2][2];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= k; i++) scanf("%d", &x), w[--x] = 1;
  memset(dp, -0x3f, sizeof(dp));
  for (int i = 0; i < (1 << n - 1); i++) {
    dp[1][i][w[i << 1]][w[i << 1 | 1]] = w[i << 1] | w[i << 1 | 1];
    dp[1][i][w[i << 1 | 1]][w[i << 1]] = w[i << 1] | w[i << 1 | 1];
  }
  for (int i = 2; i <= n; i++) {
    int s = 1 << n - i;
    for (int j = 0; j < s; j++) {
      for (int w1 = 0; w1 < 2; w1++)
        for (int l1 = 0; l1 < 2; l1++)
          for (int w2 = 0; w2 < 2; w2++)
            for (int l2 = 0; l2 < 2; l2++) {
              int tt =
                  dp[i - 1][j << 1][w1][l1] + dp[i - 1][j << 1 | 1][w2][l2];
              dp[i][j][w1 | w2][l1 | l2] = max(dp[i][j][w1 | w2][l1 | l2],
                                               tt + (w1 | w2) + (l1 | l2) * 2);
              if (w1 | w2)
                dp[i][j][w1 + w2 - 1][1] = max(dp[i][j][w1 + w2 - 1][1],
                                               tt + (w1 | w2) + 1 + (l1 | l2));
            }
    }
  }
  for (int w1 = 0; w1 < 2; w1++)
    for (int l1 = 0; l1 < 2; l1++) ans = max(ans, dp[n][0][w1][l1] + (w1 | l1));
  printf("%d", ans);
}
