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