#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c = getchar();
  int p = 1, ret = 0;
  while ((c < '0') || (c > '9')) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while ((c >= '0') && (c <= '9'))
    ret = (ret << 1) + (ret << 3) + c - '0', c = getchar();
  return ret * p;
}
long long n, k;
long long s[2], p[2];
long long get(long long now, long long to) {
  if (now <= to * 2) return 0;
  long long re = 0;
  s[0] = 1;
  s[1] = 0;
  p[0] = now;
  p[1] = now - 1;
  while (p[1] >= to * 2) {
    if (p[1] == to * 2) return s[0] + re;
    if (p[0] & 1) {
      re += s[0] + s[1];
      s[0] = s[0] * 2 + s[1];
      p[1] = p[0] / 2 - 1;
      p[0] = p[0] / 2;
    } else {
      re += s[0] + s[1];
      s[1] = s[1] * 2 + s[0];
      p[1] = p[0] / 2 - 1;
      p[0] = p[0] / 2;
    }
  }
  return re;
}
inline long long solve(long long l, long long r, long long p, long long k) {
  long long mid = (l + r) / 2;
  if (k == 1) return mid;
  long long tmp = get(mid - l, p), Tmp = get(r - mid, p + 1);
  if (k > tmp + Tmp + 1)
    return solve(mid + 1, r, p, k - tmp - 1);
  else
    return solve(l, mid - 1, p, k - Tmp - 1);
}
int main() {
  scanf("%I64d%I64d", &n, &k);
  if (k <= 2) {
    printf("%I64d", k == 1 ? 1 : n);
    return 0;
  }
  n -= 2;
  k -= 2;
  long long l = 0, r = n / 2 + 1;
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (get(n, mid) < k)
      r = mid;
    else
      l = mid;
  }
  printf("%I64d", solve(1, n, l, k) + 1);
}
