#include <bits/stdc++.h>
using namespace std;
int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + (ch ^ 48), ch = getchar();
  return s * w;
}
int n, K, f[20][331073][4];
signed main() {
  n = read(), K = read(), memset(f, -0x3f, sizeof(f));
  for (int i = 1, x; i <= K; i++) {
    x = (read() - 1) / 2 + 1;
    if (f[n - 1][x][0] > 0)
      f[n - 1][x][0] = f[n - 1][x][1] = f[0][0][0], f[n - 1][x][2] = 1;
    else
      f[n - 1][x][0] = f[n - 1][x][1] = 1;
  }
  for (int i = n - 1; i; i--)
    for (int j = 1, tt = (1 << (i - 1)); j <= tt; j++)
      f[i - 1][j]
       [0] = max(f[i - 1][j][0], f[i][j * 2 - 1][0] + 2),
  f[i - 1][j][0] = max(f[i - 1][j][0], f[i][j * 2][0] + 2),
  f[i - 1][j][1] = max(f[i - 1][j][1], f[i][j * 2 - 1][1] + 1),
  f[i - 1][j][1] = max(f[i - 1][j][1], f[i][j * 2][1] + 1),
  f[i - 1][j][2] = max(f[i - 1][j][2], f[i][j * 2 - 1][2] + 3),
  f[i - 1][j][2] = max(f[i - 1][j][2], f[i][j * 2][2] + 3),
  f[i - 1][j][0] = max(f[i - 1][j][0], f[i][j * 2 - 1][0] + f[i][j * 2][0] + 2),
  f[i - 1][j][2] = max(f[i - 1][j][2], f[i][j * 2 - 1][1] + f[i][j * 2][1] + 2),
  f[i - 1][j][2] = max(f[i - 1][j][2], f[i][j * 2 - 1][2] + f[i][j * 2][2] + 3),
  f[i - 1][j][2] = max(f[i - 1][j][2], f[i][j * 2 - 1][0] + f[i][j * 2][1] + 3),
  f[i - 1][j][2] = max(f[i - 1][j][2], f[i][j * 2 - 1][1] + f[i][j * 2][0] + 3),
  f[i - 1][j][2] = max(f[i - 1][j][2], f[i][j * 2 - 1][0] + f[i][j * 2][2] + 3),
  f[i - 1][j][2] = max(f[i - 1][j][2], f[i][j * 2 - 1][2] + f[i][j * 2][0] + 3),
  f[i - 1][j][2] = max(f[i - 1][j][2], f[i][j * 2 - 1][1] + f[i][j * 2][2] + 3),
  f[i - 1][j][2] = max(f[i - 1][j][2], f[i][j * 2 - 1][2] + f[i][j * 2][1] + 3);
  cout << max(max(max(f[0][1][0] + 1, f[0][1][1] + 1), f[0][1][2] + 1), 0);
  return 0;
}
