#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int m, n;
  cin >> n >> m;
  if (n > 26)
    cout << m;
  else {
    int a = 2;
    for (int i = 2; i <= n; i++) a = a * 2;
    cout << m % a;
  }
}
