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