#include <bits/stdc++.h>
#include "guess.h"

using namespace std;

int find_number(int MAX){
    int lo = 1, hi = MAX, ans = -1;

    auto smaller_equal = [&](int x){
        return smaller(x + 1);
    };

    while (lo <= hi){
        auto mid = (lo + hi) >> 1;

        if (smaller_equal(mid)){
            ans = mid;
            hi = mid - 1;
        }
        else
            lo = mid + 1;
    }

    return ans;
}

#ifndef EVAL

#include<iostream>
using namespace std;
static int n;
bool smaller (int x) {
    if (n<x) return true;
    return false;
}

extern int find_number (int);
int main () {
    int MAX,res;
    cin >> MAX >> n ;
    res=find_number(MAX);
    assert(res == n);
    cout << res ;
    cout << endl ;
    return 0;
}

#endif