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, m, cnt, ans, v[2][10], w[2][10], tot[2], sum;
map<long long, long long> su, p, vi;
void dfs(long long k) {
  if (!k) return;
  if (vi[k]) return;
  long long a, b;
  vi[k] = 1;
  if (p[k]) su[k] = 1;
  a = (k - 1) / 2;
  b = k - 1 - a;
  dfs(a);
  dfs(b);
  su[k] += su[a];
  su[k] += su[b];
}
int main() {
  long long i, s, a, b, j, k, l, r, mi;
  cin >> n >> m;
  k = m - 3;
  if (m == 1) {
    cout << 1;
    return 0;
  }
  if (m == 2) {
    cout << n;
    return 0;
  }
  if (m == 3) {
    cout << (1 + n) / 2;
    return 0;
  }
  v[0][tot[0] = 1] = n - 2;
  w[0][1] = 1;
  while (1) {
    for (s = 1; s <= 4; s++) v[1][s] = w[1][s] = 0;
    tot[1] = 0;
    for (i = 1; i <= tot[0]; i++) {
      a = (v[0][i] - 1) / 2;
      b = v[0][i] - 1 - a;
      if (a) {
        for (s = 1; s <= tot[1] && a != v[1][s]; s++)
          ;
        if (s > tot[1]) v[1][++tot[1]] = a;
        w[1][s] += w[0][i];
      }
      if (b) {
        for (s = 1; s <= tot[1] && b != v[1][s]; s++)
          ;
        if (s > tot[1]) v[1][++tot[1]] = b;
        w[1][s] += w[0][i];
      }
    }
    tot[0] = tot[1];
    sum = 0;
    for (s = 1; s <= tot[0]; s++) v[0][s] = v[1][s], sum += (w[0][s] = w[1][s]);
    if (tot[0] > 1 && (v[0][1] - 1) / 2 < (v[0][2] - 1) / 2)
      swap(v[0][1], v[0][2]), swap(w[0][1], w[0][2]);
    if (tot[0] > 1 && v[0][1] == 3 && v[0][2] == 2) {
      if (w[0][1] < k)
        k -= w[0][1], p[1] = p[2] = 1;
      else
        p[3] = 1;
      break;
    }
    if (tot[0] == 1 && v[0][1] == 2) {
      p[2] = p[1] = 1;
      break;
    }
    if (tot[0] > 1 && v[0][1] + v[0][2] == 3) {
      p[1] = p[2] = 1;
      break;
    }
    if (sum < k) {
      k -= sum;
      continue;
    }
    if (tot[0] > 1 && (v[0][1] - 1) / 2 != (v[0][2] - 1) / 2) {
      if (w[0][1] < k)
        k -= w[0][1], p[v[0][2]] = 1;
      else
        p[v[0][1]] = 1;
      break;
    }
    for (s = 1; s <= tot[0]; s++) {
      p[v[0][s]] = 1;
    }
    break;
  }
  dfs(n - 2);
  l = 2;
  r = n - 1;
  j = n - 2;
  while (1) {
    a = (j - 1) / 2;
    b = j - 1 - a;
    mi = (l + r) / 2;
    if (a && su[a] >= k) {
      r = mi - 1;
      j = a;
      continue;
    }
    k -= su[a];
    if (k == 1 && p[j]) {
      ans = mi;
      break;
    }
    k -= p[j];
    l = mi + 1;
    j = b;
  }
  cout << ans;
  return 0;
}