#include <bits/stdc++.h>
inline int rd() {
  int k(0);
  char c(getchar());
  while (c > '9' || c < '0') c = getchar();
  while (c >= '0' && c <= '9') k = k * 10 + c - 48, c = getchar();
  return k;
}
const int N = 18;
inline void cMax(int& x, const int y) { x = x > y ? x : y; }
inline int Max(const int x, const int y) { return x > y ? x : y; }
int n, m, f[N][1 << N][2][2], w[1 << N];
int main() {
  n = rd(), m = rd(), memset(f, -0x3f, sizeof f);
  while (m--) w[rd() - 1] = 1;
  for (int i(0); i < 1 << (n - 1); ++i) {
    int _0 = w[i << 1], _1 = w[i << 1 | 1];
    f[1][i][_0][_1] = f[1][i][_1][_0] = _0 | _1;
  }
  for (int i(2); i <= n; ++i) {
    int s(1 << (n - i));
    for (int _(0); _ < 16; ++_) {
      int w1(_ & 1), l1((_ >> 1) & 1), w2((_ >> 2) & 1), l2((_ >> 3) & 1);
      for (int j(0); j < s; ++j) {
        int t(f[i - 1][j << 1][w1][l1] + f[i - 1][j << 1 | 1][w2][l2]);
        cMax(f[i][j][w1 | w2][l1 | l2], t + ((l1 | l2) << 1) + (w1 | w2));
        if (w1 | w2) cMax(f[i][j][w1 & w2][1], t + (l1 | l2) + 2);
      }
    }
  }
  printf("%d\n",
         Max(f[n][0][0][0],
             Max(Max(f[n][0][1][0], f[n][0][1][1]), f[n][0][0][1]) + 1));
  return 0;
}
