#include <bits/stdc++.h>
using namespace std;
long long one = 1LL;
int main() {
  long long n, m;
  cin >> n >> m;
  if (n > 30) {
    cout << m << endl;
  } else {
    cout << (m % (one << n)) << endl;
  }
  return 0;
}
