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