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>
using namespace std;
long long n, k;
long long l, r, lc, rc, lx, ly, rx, ry, pos, tlc, trc;
void gnext(long long &l, long long &r, long long &lc, long long &rc) {
  lx = (l + 1ll) / 2ll;
  ly = l - lx + 1;
  rx = (r + 1ll) / 2ll;
  ry = r - rx + 1;
  l = lx;
  tlc = 1ll * (lx == l) * lc + 1ll * (ly == l) * lc + 1ll * (rx == l) * rc +
        1ll * (ry == l) * rc;
  if (rc)
    r = ry;
  else
    r = ly;
  if (r == l) r = 0;
  trc = 1ll * (ry == r) * rc + 1ll * (lx == r) * lc + 1ll * (ly == r) * lc +
        1ll * (rx == r) * rc;
  lc = tlc;
  rc = trc;
}
long long count(long long len, long long x, int dep, int now, int lo, int ro) {
  long long l = len, r = len, lc = 1, rc = 0;
  if (now > dep) return 0;
  while (now < dep) {
    gnext(l, r, lc, rc);
    ++now;
  }
  if (lo && ro) {
    long long cl = lc * (l == x) + rc * (r == x);
    long long cr = lc * (l == x + 1ll) + rc * (r == x + 1ll);
    return lo * cl + ro * cr;
  }
  if (l == x) return lc;
  if (r == x) return rc;
  return 0;
}
long long find(long long l, long long r, long long x, long long k, int dep,
               int now, int lo, int ro) {
  if (dep == now) {
    long long ret = (l + r) >> 1ll;
    if (lo == 1 && ro == 2) return ret + k - 1ll;
    if (lo == 2 && ro == 2) {
      if (r - l + 1ll == 5ll) {
        if (k == 1ll)
          return ret - 1ll;
        else
          return ret + 1ll;
      }
      return ret + k - 1ll;
    }
    return ret;
  }
  long long mid = (l + r) >> 1ll;
  long long tmp = count(mid - l + 1, x, dep, now + 1, lo, ro);
  if (k <= tmp)
    return find(l, mid, x, k, dep, now + 1, lo, ro);
  else
    return find(mid, r, x, k - tmp, dep, now + 1, lo, ro);
}
int dep, flag;
int main() {
  scanf("%I64d%I64d", &n, &k);
  l = n;
  lc = 1;
  if (k == 1ll) return puts("1"), 0;
  if (k == 2ll) return printf("%I64d\n", n), 0;
  k -= 2ll;
  while (k >= 1ll) {
    if (l == 4ll && !rc) {
      long long rk = (k - 1ll) / 2ll;
      return printf("%I64d\n", 1ll + rk * 3ll + 1ll + ((k - 1) & 1ll)), 0;
    }
    if (l == 3ll && r == 4ll) {
      return printf("%I64d\n", find(1, n, 3, k, dep, 0, 1, 2)), 0;
    }
    if (l == 4ll && r == 5ll) {
      if (k <= rc) {
        pos = r;
        break;
      }
      k -= rc;
      return printf("%I64d\n", find(1, n, 4, k, dep, 0, 2, 2)), 0;
    }
    if (k > lc + rc) {
      k -= lc + rc;
    } else {
      if (rc && (l & 1)) {
        flag = 1;
        pos = l;
      } else {
        if (k <= rc)
          pos = r;
        else
          k -= rc, pos = l;
      }
      break;
    }
    gnext(l, r, lc, rc);
    ++dep;
  }
  printf("%I64d\n", find(1, n, pos, k, dep, 0, flag, flag));
}