#include <bits/stdc++.h>
using namespace std;
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  fast();
  int n, m;
  cin >> n >> m;
  long double p = pow((double)2, (double)n);
  cout << m % (long long)p << endl;
  return 0;
}
