#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m;
  cin >> n >> m;
  if (n >= 27)
    cout << m << endl;
  else {
    int prod = 1;
    for (int i = n; i > 0; i--) {
      prod = prod * 2;
    }
    cout << m % prod << endl;
  }
  return 0;
}
