#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stck:1024000000,1024000000")
long long quick_pow(long long n) {
  long long ans = 1;
  long long cnt = 2;
  while (n) {
    if (n & 1) ans = ans * cnt;
    n >>= 1;
    cnt *= cnt;
  }
  return ans;
}
int main() {
  long long n, m;
  scanf("%lld%lld", &n, &m);
  if (n >= 32)
    printf("%lld\n", m);
  else
    printf("%lld\n", m % quick_pow(n));
  return 0;
}
