#include <bits/stdc++.h>
using namespace std;
long long cal1(long long n, long long len, map<long long, long long>& mp) {
  if (mp.count(n)) return mp[n];
  if ((n - 1) / 2 < len) return 0;
  return mp[n] = 1 + cal1((n - 1) / 2, len, mp) +
                 cal1(n - 1 - (n - 1) / 2, len, mp);
}
long long cal3(long long n, long long len, map<long long, long long>& mp) {
  if (mp.count(n)) return mp[n];
  if (n == 0) return 0;
  if ((n - 1) / 2 < len) return 0;
  return mp[n] = ((n - 1) / 2 == len) + cal3((n - 1) / 2, len, mp) +
                 cal3(n - 1 - (n - 1) / 2, len, mp);
}
long long cal2(long long n, long long sum, long long len,
               map<long long, long long>& mp) {
  if ((n - 1) / 2 == len) {
    if (sum == 1) {
      return (n - 1) / 2 + 1;
    } else {
      sum--;
    }
  }
  if (cal3((n - 1) / 2, len, mp) >= sum)
    return cal2((n - 1) / 2, sum, len, mp);
  else
    return cal2(n - 1 - (n - 1) / 2, sum - cal3((n - 1) / 2, len, mp), len,
                mp) +
           (n - 1) / 2 + 1;
}
int main(int argc, char* argv[]) {
  long long n, k;
  cin >> n >> k;
  if (k == 1) {
    cout << 1 << endl;
  } else if (k == 2) {
    cout << n << endl;
  } else {
    k -= 2;
    n -= 2;
    long long low = 1, high = n;
    while (low <= high) {
      long long mid = (low + high) / 2;
      map<long long, long long> mp;
      if (cal1(n, mid, mp) >= k) {
        low = mid + 1;
      } else {
        high = mid - 1;
      }
    }
    map<long long, long long> mp;
    long long t = k - cal1(n, low, mp);
    mp.clear();
    cout << cal2(n, t, high, mp) + 1 << endl;
  }
  return 0;
}
