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;
map<long long, long long> m2;
long long go(long long now, long long targ) {
  if (now == 0LL) {
    return 0LL;
  }
  if (m2.find(now) != m2.end()) {
    return m2[now];
  }
  long long ret = 0LL;
  long long half = now / 2LL;
  long long other = now - 1LL - half;
  long long space = (now - 1LL) / 2LL;
  if (space == targ) {
    ret++;
  }
  ret += go(half, targ);
  ret += go(other, targ);
  m2[now] = ret;
  return ret;
}
long long go2(long long now, long long rem, long long targ) {
  if (now == 0) {
    return 0LL;
  }
  long long half = now / 2LL;
  long long other = now - 1LL - half;
  long long space = (now - 1LL) / 2LL;
  if (space == targ && rem == 1) {
    return (now / 2LL) + (now % 2LL);
  }
  if (space == targ) {
    rem--;
  }
  if (other > 0 && m2[other] >= rem) {
    return go2(other, rem, targ);
  } else {
    return other + 1LL + go2(half, rem - m2[other], targ);
  }
}
int main() {
  long long n, k;
  cin >> n >> k;
  if (k == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (k == 2) {
    cout << n << endl;
    return 0;
  }
  n -= 2;
  k -= 2;
  map<long long, long long> m1;
  deque<long long> li1;
  m1[n] = 1LL;
  li1.push_back(n);
  long long val = -1;
  long long ind = -1;
  long long freq = 0LL;
  long long last = -1LL;
  while (li1.size() != 0) {
    long long now = li1.front();
    li1.pop_front();
    long long size = m1[now];
    if (size == 0) {
      continue;
    }
    long long half = now / 2LL;
    long long other = now - 1LL - half;
    long long space = (now - 1LL) / 2LL;
    if (now == 0LL) {
      last = 0LL;
    }
    if (space != last || now == 0LL) {
      if (freq >= k) {
        ind = k;
        val = last;
        break;
      } else {
        k -= freq;
        freq = 0;
      }
      last = space;
    }
    freq += size;
    if (m1.find(half) == m1.end()) {
      m1[half] = 0LL;
    }
    if (m1.find(other) == m1.end()) {
      m1[other] = 0LL;
    }
    m1[half] = m1[half] + size;
    m1[other] = m1[other] + size;
    m1[now] = 0LL;
    li1.push_back(half);
    li1.push_back(other);
  }
  m2[0LL] = 0LL;
  go(n, val);
  long long ans = (1LL + go2(n, ind, val));
  cout << ans << endl;
  return 0;
}