#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
inline int D() {
  int m;
  cin >> m;
  return m;
}
inline long long lD() {
  long long m;
  cin >> m;
  return m;
}
inline double dD() {
  double m;
  cin >> m;
  return m;
}
int arr[105];
int main() {
  int n = D(), m = D();
  if (n >= 27)
    cout << m << "\n";
  else
    cout << m % (long long)(pow(2, n)) << "\n";
}
