#include <bits/stdc++.h>
using namespace std;
long long m, n, x, y, z, p, q, r;
int main() {
  cin >> n >> m;
  if (n > 40) {
    cout << m << endl;
    return 0;
  }
  long long tmp = 1;
  for (long long i = 1; i <= n; i++) tmp = tmp * 2LL;
  cout << m % tmp << endl;
  return 0;
}
