#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int powd = 1;
  for (int i = 0; i < n; i++) {
    powd *= 2;
    if (powd > m) {
      cout << m;
      return 0;
    }
  }
  cout << m % powd;
  return 0;
}
