#include <bits/stdc++.h>
using namespace std;
const int mxn = 17;
int n, m;
int dp[mxn + 1][1 << mxn][2][2];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  memset(dp, 0xcf, sizeof(dp));
  memset(dp[0], 0, sizeof(dp[0]));
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    dp[0][--x][1][0] = 1;
  }
  for (int i = 0; i < (1 << (n - 1)); i++) {
    int x = dp[0][i << 1][1][0], y = dp[0][i << 1 | 1][1][0];
    dp[1][i][x][y] = dp[1][i][y][x] = x | y;
  }
  for (int i = 2; i <= n; i++)
    for (int j = 0; j < (1 << (n - i)); j++)
      for (int k1 = 0; k1 < 2; k1++)
        for (int l1 = 0; l1 < 2; l1++)
          for (int k2 = 0; k2 < 2; k2++)
            for (int l2 = 0; l2 < 2; l2++) {
              int x = dp[i - 1][j << 1][k1][l1] + dp[i - 1][j << 1 | 1][k2][l2];
              int &f1 = dp[i][j][k1 | k2][l1 | l2];
              f1 = max(f1, x + (k1 | k2) + 2 * (l1 | l2));
              if (k1 | k2) {
                int &f2 = dp[i][j][k1 + k2 - 1][1];
                f2 = max(f2, x + 2 + (l1 | l2));
              }
            }
  int ret = 0;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++) {
      ret = max(ret, dp[n][0][i][j] + (i | j));
    }
  cout << ret << '\n';
  return 0;
}
