"use strict";
function Main(input) {
    let cols = input.split(/\s/).map((v) => v - 0);
    let N = cols[0], X = cols[1];
    let memo = new Array(N);
    memo[0] = "P";
    const f = (n) => {
        if (memo[n] == null) {
            memo[n] = "B" + f(n-1) + "P" + f(n-1) + "B";
        }
        return memo[n];
    }
    let ans = 0, b;
    for (let n = 1; n <= N; n++) {
        b = f(n);
    }
    for (let n = 0; n < X; n++) {
        if (b.charAt(n) == "P") ans += 1;
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
