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;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline bool smin(T &a, const T &b) {
  return a > b ? a = b : a;
}
template <typename T>
inline bool smax(T &a, const T &b) {
  return a < b ? a = b : a;
}
const long long N = (long long)505, mod = (long long)0;
set<long long> values;
long long contain[N][N];
long long gd(long long first) { return (first + 1) / 2; }
int32_t main() {
  long long n, num;
  cin >> n >> num;
  if (num == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (num == 2) {
    cout << n << endl;
    return 0;
  }
  n -= 2;
  num -= 2;
  values.insert(n);
  for (long long turn = 0; turn < 100; ++turn) {
    for (long long first : values)
      if (first >= 1) {
        values.insert(gd(first) - 1);
        values.insert(first - gd(first));
      }
  }
  vector<long long> all;
  for (long long first : values) all.push_back(first);
  vector<long long> dv;
  long long sz = (long long)all.size();
  sort(all.begin(), all.end());
  reverse(all.begin(), all.end());
  for (long long first : all) dv.push_back(gd(first));
  sort((dv).begin(), (dv).end());
  dv.resize(unique((dv).begin(), (dv).end()) - dv.begin());
  reverse(dv.begin(), dv.end());
  long long dsz = (long long)dv.size();
  map<long long, long long> rev;
  for (long long j = 0; j < dsz; ++j) rev[dv[j]] = j;
  map<long long, long long> pl;
  for (long long j = 0; j < (long long)all.size(); ++j) pl[all[j]] = j;
  for (long long j = sz - 1; j >= 0; --j) {
    long long first = all[j];
    contain[j][rev[gd(first)]] = 1;
    for (long long k = 0; k < sz; ++k)
      contain[j][k] +=
          contain[pl[gd(first) - 1]][k] + contain[pl[first - gd(first)]][k];
  }
  long long house = 0, dist = -1;
  long long tmp = num;
  for (long long j = 0; j < dsz; ++j) {
    tmp -= contain[0][j];
    if (tmp <= 0) {
      dist = dv[j];
      tmp += contain[0][j];
      break;
    }
  }
  if (dist == -1) assert(0);
  num = tmp - 1;
  long long size = n;
  while (true) {
    if (gd(size) == dist) --num;
    if (num == -1 && gd(size) == dist) {
      cout << house + gd(size) + 1 << endl;
      return 0;
    }
    if (size == -1) break;
    if (num < contain[pl[gd(size) - 1]][rev[dist]]) {
      size = gd(size) - 1;
    } else {
      num -= contain[pl[gd(size) - 1]][rev[dist]];
      house += gd(size);
      size = size - gd(size);
    }
  }
}