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;
void Add(map<long long, long long> &M, pair<long long, long long> t) {
  if (t.first > 1) {
    if (t.first / 2 == 2)
      M[1] += t.second * 2;
    else
      M[t.first / 2] += t.second;
  }
  if (t.first > 2) {
    if (t.first - 1 - t.first / 2 == 2)
      M[1] += t.second * 2;
    else
      M[t.first - 1 - t.first / 2] += t.second;
  }
}
long long get(long long X, long long x1, long long x2) {
  if (X == 0) return 0;
  if (X == x1 || X == x2) return 1;
  map<long long, long long> M;
  if (X == 2)
    M[1] += 2;
  else
    M[X]++;
  long long res = 0;
  while (1) {
    if ((int)(M).size() == 0) break;
    if ((int)(M).size() > 1) {
      auto it = --M.end();
      pair<long long, long long> a = *it;
      auto jt = it;
      --jt;
      pair<long long, long long> b = *jt;
      if (abs(a.first - b.first) == 1 && (a.first ^ b.first) != 1) {
        if (it->first == x1 || it->first == x2) res += it->second;
        if (jt->first == x1 || jt->first == x2) res += jt->second;
        M.erase(it);
        M.erase(jt);
        Add(M, a);
        Add(M, b);
        continue;
      }
    }
    auto it = --M.end();
    if (it->first == x1 || it->first == x2) res += it->second;
    M.erase(it);
    pair<long long, long long> t = *it;
    Add(M, t);
  }
  return res;
}
long long Do(long long l, long long r, long long x1, long long x2,
             long long y1) {
  if (r - l + 1 == x1 || r - l + 1 == x2) return (l + r) >> 1;
  if (r - l + 1 == 2) {
    return l + y1 - 1;
  }
  long long m = (l + r) >> 1;
  long long a = get(m - l, x1, x2);
  if (a >= y1)
    return Do(l, m - 1, x1, x2, y1);
  else
    return Do(m + 1, r, x1, x2, y1 - a);
}
void solve() {
  long long n, k;
  scanf("%lld%lld", &n, &k);
  if (k == 1)
    printf("%d\n", 1);
  else if (k == 2)
    printf("%lld\n", n);
  else if (n <= 4) {
    int q[4][4] = {{1}, {1, 2}, {1, 3, 2}, {1, 4, 2, 3}};
    printf("%d\n", q[n - 1][k - 1]);
  } else {
    map<long long, long long> M;
    M[n - 2] = 1;
    long long nk = k - 2;
    long long x1 = -1, x2 = -1, y1 = -1;
    while (1) {
      if ((int)(M).size() > 1) {
        auto it = --M.end();
        pair<long long, long long> a = *it;
        auto jt = it;
        --jt;
        pair<long long, long long> b = *jt;
        if (abs(a.first - b.first) == 1 && (a.first ^ b.first) != 1) {
          long long c = a.second + b.second;
          if (nk <= c) {
            x1 = a.first, x2 = b.first;
            y1 = nk;
            break;
          } else {
            M.erase(it);
            M.erase(jt);
            nk -= c;
            Add(M, a);
            Add(M, b);
            continue;
          }
        }
      }
      if (nk <= M.rbegin()->second) {
        x1 = M.rbegin()->first;
        y1 = nk;
        break;
      } else {
        nk -= M.rbegin()->second;
        pair<long long, long long> t = *M.rbegin();
        M.erase(--M.end());
        Add(M, t);
      }
    }
    printf("%lld\n", Do(2, n - 1, x1, x2, y1));
  }
}
int main() {
  int Tc = 1;
  for (int tc = 1; tc <= Tc; tc++) {
    solve();
  }
  return 0;
};