#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
map<pair<long long, long long>, long long> _memo;
long long get(long long N, long long D) {
  auto entry = make_pair(N, D);
  if (_memo.find(entry) != _memo.end()) {
    return _memo[entry];
  }
  if (N < D) return 0;
  long long res = 1 + get((N - 1) / 2, D) + get(N / 2, D);
  return _memo[entry] = res;
}
int main() {
  long long N, K;
  cin >> N >> K;
  if (K == 1) {
    cout << 1 << endl;
    return 0;
  } else if (K == 2) {
    cout << N << endl;
    return 0;
  }
  N -= 2;
  K -= 2;
  long long L = 1, R = N;
  while (L < R) {
    long long S = (L + R + 1) / 2;
    if (get(N, S) >= K) {
      L = S;
    } else {
      R = S - 1;
    }
  }
  long long distance = L;
  if (distance % 2 == 0) --distance;
  long long A = 1, B = N;
  while (true) {
    long long C = (A + B) / 2;
    if (K == 1) {
      cout << C + 1 << endl;
      return 0;
    }
    if (get(C - A, distance) + 1 + get(B - C, distance + 2) < K) {
      K -= get(C - A, distance) + 1;
      A = C + 1;
    } else {
      K -= get(B - C, distance + 2) + 1;
      B = C - 1;
    }
  }
}
