#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
ll n, m;
int main() {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cout << fixed;
  cin >> n >> m;
  if (n >= 30) {
    cout << m << endl;
    return 0;
  } else {
    cout << m % (1LL << n) << endl;
  }
  return 0;
}
