#include <bits/stdc++.h>
using namespace std;
inline void R(long long &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
void Redirect() {
  freopen(".in", "r", stdin);
  freopen(".out", "w", stdout);
}
long long n, k;
map<pair<long long, long long>, long long> mem;
long long check(long long s, long long m) {
  if (!s) return 0;
  if (mem.count(make_pair(s, m))) return mem[make_pair(s, m)];
  long long ret = 0;
  long long l = (s - 1) >> 1;
  long long r = s - 1 - l;
  if (l < m) return 0;
  return mem[make_pair(s, m)] = 1 + check(l, m) + check(r, m);
}
long long put(long long l, long long r, long long low, long long k) {
  long long mid = (l + r) >> 1;
  if (k == 1) return mid;
  k--;
  long long ls = check(mid - l, low);
  long long rs = check(r - mid, low + 1);
  if (ls + rs >= k) {
    return put(l, mid - 1, low, k - rs);
  } else {
    return put(mid + 1, r, low, k - ls);
  }
}
int main() {
  R(n);
  R(k);
  if (k == 1) {
    printf("%I64d\n", 1l);
    return 0;
  } else if (n == 2 || k == 2) {
    printf("%I64d\n", n);
    return 0;
  }
  k -= 2;
  long long l = 0, r = n + 1;
  while (r - l > 1) {
    register long long mid = (l + r) >> 1;
    if (check(n - 2, mid) >= k)
      l = mid;
    else
      r = mid;
  }
  printf("%I64d\n", k = put(2, n - 1, l, k));
}
