#include <bits/stdc++.h>
using namespace ::std;
int aa;
const long long maxn = 1e5 + 500;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 500;
int main() {
  long long n, m;
  aa++;
  cin >> n >> m;
  aa++;
  if (n > 30) {
    aa++;
    cout << m;
    aa++;
  } else {
    aa++;
    n = (1LL << n);
    aa++;
    cout << m % n;
    aa++;
  }
  aa++;
  aa++;
}
