Problem: It's been long after the events of the previous problems, and Karen has now moved on from student life and is looking to relocate to a new neighborhood.

<image>

The neighborhood consists of n houses in a straight line, labelled 1 to n from left to right, all an equal distance apart.

Everyone in this neighborhood loves peace and quiet. Because of this, whenever a new person moves into the neighborhood, he or she always chooses the house whose minimum distance to any occupied house is maximized. If there are multiple houses with the maximum possible minimum distance, he or she chooses the leftmost one.

Note that the first person to arrive always moves into house 1.

Karen is the k-th person to enter this neighborhood. If everyone, including herself, follows this rule, which house will she move into?

Input

The first and only line of input contains two integers, n and k (1 ≤ k ≤ n ≤ 1018), describing the number of houses in the neighborhood, and that Karen was the k-th person to move in, respectively.

Output

Output a single integer on a line by itself, the label of the house Karen will move into.

Examples

Input

6 4


Output

2


Input

39 3


Output

20

Note

In the first test case, there are 6 houses in the neighborhood, and Karen is the fourth person to move in:

  1. The first person moves into house 1. 
  2. The second person moves into house 6. 
  3. The third person moves into house 3. 
  4. The fourth person moves into house 2. 



In the second test case, there are 39 houses in the neighborhood, and Karen is the third person to move in:

  1. The first person moves into house 1. 
  2. The second person moves into house 39. 
  3. The third person moves into house 20. 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
clock_t t = clock();
namespace my_std {
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
inline T rnd(T l, T r) {
  return uniform_int_distribution<T>(l, r)(rng);
}
template <typename T>
inline bool chkmax(T& x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmin(T& x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
inline void read(T& t) {
  t = 0;
  char f = 0, ch = getchar();
  double d = 0.1;
  while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
  while (ch <= '9' && ch >= '0') t = t * 10 + ch - 48, ch = getchar();
  if (ch == '.') {
    ch = getchar();
    while (ch <= '9' && ch >= '0') t += d * (ch ^ 48), d *= 0.1, ch = getchar();
  }
  t = (f ? -t : t);
}
template <typename T, typename... Args>
inline void read(T& t, Args&... args) {
  read(t);
  read(args...);
}
char __sr[1 << 21], __z[20];
int __C = -1, __zz = 0;
inline void Ot() { fwrite(__sr, 1, __C + 1, stdout), __C = -1; }
inline void print(register int x) {
  if (__C > 1 << 20) Ot();
  if (x < 0) __sr[++__C] = '-', x = -x;
  while (__z[++__zz] = x % 10 + 48, x /= 10)
    ;
  while (__sr[++__C] = __z[__zz], --__zz)
    ;
  __sr[++__C] = '\n';
}
void file() {}
inline void chktime() {}
long long ksm(long long x, int y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x)
    if (y & 1) ret = ret * x;
  return ret;
}
}  // namespace my_std
using namespace my_std;
long long n, K;
map<long long, map<long long, long long>> dp;
map<long long, int> vis;
void DP(long long n) {
  if (vis[n]) return;
  if (!n) return;
  if (n == 1) return dp[1][0] = 1, void();
  vis[n] = 1;
  --n;
  long long L = n / 2, R = n - L;
  ++n;
  dp[n][L] = 1;
  DP(L), DP(R);
  for (auto x : dp[L]) dp[n][x.first] += x.second;
  for (auto x : dp[R]) dp[n][x.first] += x.second;
}
long long work(long long n, long long K) {
  if (K == 1) return (n - 1) / 2 + 1;
  --K;
  long long L = (n - 1) / 2, R = n - 1 - L;
  vector<pair<long long, long long>> V1, V2;
  for (auto x : dp[L]) V1.push_back(x);
  for (auto x : dp[R]) V2.push_back(x);
  reverse(V1.begin(), V1.end()), reverse(V2.begin(), V2.end());
  int p = 0, q = 0;
  long long c1 = 0, c2 = 0;
  while (233) {
    pair<long long, long long> cur;
    int flg;
    if (p == (int)V1.size())
      flg = 1, cur = V2[q++];
    else if (q == (int)V2.size())
      flg = 0, cur = V1[p++];
    else if (V1[p].first >= V2[q].first)
      flg = 0, cur = V1[p++];
    else
      flg = 1, cur = V2[q++];
    if (cur.second < K)
      (flg ? c2 : c1) += cur.second, K -= cur.second;
    else if (!flg)
      return work(L, c1 + K);
    else
      return work(R, c2 + K) + L + 1;
  }
}
int main() {
  file();
  read(n, K);
  if (K == 1) return printf("1"), 0;
  if (K == 2) return printf("%lld", n), 0;
  n -= 2, K -= 2;
  DP(n);
  long long ans = work(n, K) + 1;
  printf("%lld\n", ans);
  return 0;
}