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, rem;
vector<pair<long long, long long> > v, nv;
long long a, b;
long long calc(long long x, long long need) {
  map<long long, long long> ma;
  ma[x] = 1;
  while (true) {
    auto it = ma.end();
    --it;
    long long val = it->first;
    long long cnt = it->second;
    if (val == need) {
      return cnt;
    }
    if (val < need) {
      return 0;
    }
    ma.erase(it);
    ma[(val - 1) / 2] += cnt;
    ma[val / 2] += cnt;
  }
  return -1;
}
void sol1(long long len, long long pos) {
  if (len == a) {
    assert(rem == 1);
    cout << pos + (len - 1) / 2 << endl;
    exit(0);
  }
  long long mid = pos + (len - 1) / 2;
  long long le = (len - 1) / 2;
  long long ri = len / 2;
  long long cnt = calc(le, a);
  if (rem <= cnt) {
    sol1(le, pos);
  } else {
    rem -= cnt;
    sol1(ri, mid + 1);
  }
}
void sol2(long long len, long long pos) {
  if (len == a || len == b) {
    assert(rem == 1 || rem == 2);
    cout << pos + (len - 1) / 2 + rem - 1 << endl;
    exit(0);
  }
  long long mid = pos + (len - 1) / 2;
  long long le = (len - 1) / 2;
  long long ri = len / 2;
  long long cnt = calc(le, a) + calc(le, b);
  if (rem <= cnt) {
    sol2(le, pos);
  } else {
    rem -= cnt;
    sol2(ri, mid + 1);
  }
}
void solve1(long long a) {
  ::a = a;
  sol1(n - 2, 2);
}
void solve2(long long a, long long b) {
  ::a = a;
  ::b = b;
  sol2(n - 2, 2);
}
int main() {
  cin >> n >> k;
  if (k == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (k == 2) {
    cout << n << endl;
    return 0;
  }
  k -= 2;
  v.push_back(make_pair(n - 2, 1));
  rem = k;
  while (true) {
    if ((int)v.size() == 1) {
      if (v[0].first % 2 == 0) {
        v.push_back(make_pair(v[0].first - 1, 0));
        sort(v.begin(), v.end());
      } else {
        v.push_back(make_pair(v[0].first + 1, 0));
      }
    }
    map<long long, long long> ma;
    if ((v[0].first - 1) / 2 == (v[1].first - 1) / 2) {
      if (v[0].first != 1) {
        if (rem <= v[0].second + v[1].second) {
          solve2(v[0].first, v[1].first);
        }
        for (int i = 0; i < (int)(2); ++i) {
          ma[(v[i].first - 1) / 2] += v[i].second;
          ma[v[i].first / 2] += v[i].second;
        }
      } else {
        solve2(v[0].first, v[1].first);
      }
      rem -= v[0].second + v[1].second;
    } else {
      if (rem <= v[1].second) {
        solve1(v[1].first);
      }
      rem -= v[1].second;
      ma[(v[1].first - 1) / 2] += v[1].second;
      ma[v[1].first / 2] += v[1].second;
      ma[v[0].first] += v[0].second;
    }
    nv.clear();
    for (auto p : ma) {
      if (p.first > 0) {
        nv.push_back(p);
      }
    }
    v = nv;
  }
  return 0;
}