#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  if (n > m) {
    cout << m << endl;
  } else {
    int i = 1;
    int rem = 1;
    int flag = 0;
    while (i <= n) {
      rem = rem * 2;
      if (rem > m) {
        flag = 1;
        break;
      }
      i++;
    }
    if (flag == 1)
      cout << m << endl;
    else
      cout << m % rem << endl;
  }
  return 0;
}
