#include <bits/stdc++.h>
using namespace std;
int n, k;
int dp[18][131072][2][2];
int ans;
int seq[500000];
int cnt[500000];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= k; ++i) scanf("%d", &seq[i]);
  sort(seq + 1, seq + 1 + k);
  if (n == 1) {
    printf("%d\n", (k > 0));
    return 0;
  }
  for (int i = 1; i <= k; ++i) seq[i]--;
  seq[0] = -2;
  for (int i = 1; i <= k; ++i) {
    if (seq[i] / 2 != seq[i - 1] / 2) ans++;
    cnt[seq[i] / 4]++;
  }
  int all = (1 << n - 2) - 1;
  memset(dp, -0x3f3f3f3f, sizeof(dp));
  for (int i = 0; i <= all; ++i) {
    int total = cnt[i];
    if (total == 0)
      dp[n - 2][i][0][0] = 0;
    else if (total == 1)
      dp[n - 2][i][0][1] = 2, dp[n - 2][i][1][0] = 1;
    else
      dp[n - 2][i][1][1] = 3;
  }
  for (int j = n - 3; j >= 0; --j) {
    int all = (1 << j) - 1;
    for (int i = 0; i <= all; ++i) {
      for (int u0 = 0; u0 <= 1; ++u0)
        for (int u1 = 0; u1 <= 1; ++u1)
          for (int d0 = 0; d0 <= 1; ++d0)
            for (int d1 = 0; d1 <= 1; ++d1) {
              int as =
                  dp[j + 1][i << 1][u0][u1] + dp[j + 1][i << 1 | 1][d0][d1];
              int has_down = u1 | d1;
              int up_count = u0 + d0;
              int pls = has_down;
              dp[j][i][up_count > 0][has_down] =
                  max(dp[j][i][up_count > 0][has_down],
                      as + pls + (up_count > 0) + has_down);
              if (up_count)
                dp[j][i][up_count - 1][1] = max(dp[j][i][up_count - 1][1],
                                                as + pls + (up_count > 0) + 1);
            }
    }
  }
  ans += (k > 0);
  ans += max(max(dp[0][0][0][0], dp[0][0][0][1]),
             max(dp[0][0][1][0], dp[0][0][1][1]));
  printf("%d\n", ans);
}
