/*
    No.820 Power of Two
    https://yukicoder.me/problems/no/820
*/
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long int n, k;
    cin >> n >> k;
    long long int x = pow(2, k);
    long long int div = pow(2, k);
    long long int limit = (long long int)pow(2, n);
    int count = 0;

    while (limit >= x) {
        // cerr << "limit, x = " << limit << ", " << x << endl;
        count++;
        x += div;
    }
    cout << count << endl;

    return 0;
}