#include <bits/stdc++.h>
long long n, k;
long long cal(long long n, long long dis) {
  if (dis * 2 + 1 > n) return 0;
  long long ret = 0;
  for (long long dis0 = n - 1, dis1 = n, s0 = 0, s1 = 1; dis1 >= dis * 2 + 1;
       dis0 = (dis0 - 1) / 2, dis1 /= 2) {
    if (dis1 == dis * 2 + 1) return ret + s1;
    ret += s0 + s1;
    if (dis0 & 1)
      s0 = s0 * 2 + s1;
    else
      s1 = s1 * 2 + s0;
  }
  return ret;
}
long long solve(long long l, long long r, long long dis, long long k) {
  long long mid = (l + r) >> 1;
  if (k == 1) return mid;
  long long cl = cal(mid - l, dis), cr = cal(r - mid, dis + 1);
  if (cl + cr + 1 >= k) return solve(l, mid - 1, dis, k - cr - 1);
  return solve(mid + 1, r, dis, k - cl - 1);
}
signed main() {
  scanf("%lld%lld", &n, &k);
  if (k == 1) {
    puts("1");
    return 0;
  }
  if (k == 2) {
    printf("%lld\n", n);
    return 0;
  }
  n -= 2, k -= 2;
  long long l = 0, r = n, ans;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (cal(n, mid) >= k)
      ans = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  printf("%lld\n", solve(1, n, ans, k) + 1);
}
