#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while (((c = getchar()) == ' ') || c == '\n')
    ;
  x = c;
}
int n, m, i, j, dp[18][1 << 18][2][2], w[524289];
void upd(int &x, int y) { x = max(x, y); }
int main() {
  read(n);
  read(m);
  for (((i)) = (1); ((i)) <= ((m)); ((i))++) {
    int x;
    read(x);
    x--;
    w[x] = 1;
  }
  memset((dp), (-(0x16)), (sizeof((dp))));
  for (((i)) = (0); ((i)) <= (((1 << (n - 1))) - 1); ((i))++) {
    dp[1][i][w[i * 2]][w[i * 2 + 1]] = w[i * 2] | w[i * 2 + 1];
    dp[1][i][w[i * 2 + 1]][w[i * 2]] = w[i * 2] | w[i * 2 + 1];
  }
  for (i = 2; i <= n; i++) {
    int all = (1 << (n - i));
    for (j = 0; j < all; j++) {
      int a, b, c, d;
      for (((a)) = (0); ((a)) <= ((2) - 1); ((a))++)
        for (((b)) = (0); ((b)) <= ((2) - 1); ((b))++)
          for (((c)) = (0); ((c)) <= ((2) - 1); ((c))++)
            for (((d)) = (0); ((d)) <= ((2) - 1); ((d))++) {
              int t = dp[i - 1][j * 2][a][b] + dp[i - 1][j * 2 + 1][c][d];
              upd(dp[i][j][a | c][b | d], t + ((b | d) * 2 + (a | c)));
              if (a | c)
                upd(dp[i][j][a + c - 1][1], t + ((b | d) + (a | c) + 1));
            }
    }
  }
  int mx = 0;
  for (((i)) = (0); ((i)) <= ((2) - 1); ((i))++)
    for (((j)) = (0); ((j)) <= ((2) - 1); ((j))++) {
      upd(mx, dp[n][0][i][j] + (i | j));
    }
  cout << mx << endl;
  return 0;
}
