#include <bits/stdc++.h>
using namespace std;
long long fastpower(long long power) {
  long long result = 1;
  long long base = 2;
  while (power > 0) {
    if (power % 2 == 1) {
      result = (result * base);
    }
    base = (base * base);
    power = power / 2;
  }
  return result;
}
signed main() {
  long long n, m;
  cin >> n >> m;
  if (n > 31)
    cout << m;
  else {
    cout << m % fastpower(n);
  }
}
