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;
bool read() {
  if (scanf("%lld%lld", &n, &k) < 2) {
    return 0;
  }
  return 1;
}
vector<long long> generate(long long len) {
  vector<long long> res;
  set<long long> S;
  S.insert(len);
  while (!S.empty()) {
    long long cur = *S.rbegin();
    S.erase(cur);
    res.push_back(cur);
    if (!cur) {
      break;
    }
    S.insert((cur - 1) / 2);
    S.insert(cur / 2);
  }
  sort(begin(res), end(res));
  sort(begin(res), end(res)),
      res.resize(unique(begin(res), end(res)) - res.begin());
  return res;
}
vector<int> left_len;
vector<int> right_len;
vector<long long> lens;
vector<vector<long long> > dp;
long long get_cnt(int id, int min_left_len) {
  if (left_len[id] == min_left_len) {
    return 1;
  }
  if (left_len[id] < min_left_len) {
    return 0;
  }
  long long& ans = dp[id][min_left_len];
  if (ans != -1) {
    return ans;
  }
  ans = 0;
  ans += get_cnt(left_len[id], min_left_len);
  ans += get_cnt(right_len[id], min_left_len);
  return ans;
}
long long get_mid_pos(int id, long long k, int min_left_len) {
  assert(k);
  assert(left_len[id] >= min_left_len);
  if (left_len[id] == min_left_len) {
    return lens[min_left_len];
  }
  const long long left_cnt = get_cnt(left_len[id], min_left_len);
  if (left_cnt >= k) {
    return get_mid_pos(left_len[id], k, min_left_len);
  }
  k -= left_cnt;
  return lens[left_len[id]] + 1 + get_mid_pos(right_len[id], k, min_left_len);
}
long long get_cnt2(int id) {
  if (lens[id] == 0) {
    return 0;
  }
  if (lens[id] == 1) {
    return 1;
  }
  if (lens[id] == 2) {
    return 2;
  }
  long long& ans = dp[id][0];
  if (ans != -1) {
    return ans;
  }
  ans = 0;
  ans += get_cnt2(left_len[id]);
  ans += get_cnt2(right_len[id]);
  return ans;
}
long long get_mid_pos2(int id, long long k) {
  assert(k);
  assert(lens[id] > 0);
  if (lens[id] == 1) {
    assert(k == 1);
    return 0;
  }
  if (lens[id] == 2) {
    if (k == 1) {
      return 0;
    }
    if (k == 2) {
      return 1;
    }
    assert(0);
  }
  const long long left_cnt = get_cnt2(left_len[id]);
  if (left_cnt >= k) {
    return get_mid_pos2(left_len[id], k);
  }
  k -= left_cnt;
  return lens[left_len[id]] + 1 + get_mid_pos2(right_len[id], k);
}
int get_pos_len(long long len) {
  const int pos = lower_bound(begin(lens), end(lens), len) - lens.begin();
  assert(pos < ((int)(lens).size()) && lens[pos] == len);
  return pos;
}
long long solve() {
  if (k == 1) {
    return 1;
  }
  if (k == 2) {
    return n;
  }
  k -= 2;
  lens = generate(n - 2);
  left_len.resize(((int)(lens).size()));
  right_len.resize(((int)(lens).size()));
  for (int i = 0; i < int(((int)(lens).size())); ++i) {
    left_len[i] = get_pos_len((lens[i] - 1) / 2);
    right_len[i] = get_pos_len(lens[i] / 2);
  }
  dp.clear();
  dp.resize(((int)(lens).size()), vector<long long>(((int)(lens).size()), -1));
  vector<long long> coef(((int)(lens).size()), 0);
  coef.back() = 1;
  for (int i = ((int)(lens).size()) - 1; i >= 0;) {
    int j = i;
    while (j >= 0 && left_len[j] == left_len[i]) {
      --j;
    }
    long long sum_coef = 0;
    for (int z = j + 1; z <= i; ++z) {
      sum_coef += coef[z];
    }
    if (lens[i] == 2) {
      long long pos = get_mid_pos2(((int)(lens).size()) - 1, k);
      return pos + 2;
    }
    if (sum_coef < k) {
      k -= sum_coef;
      for (int z = j + 1; z <= i; ++z) {
        coef[left_len[z]] += coef[z];
        coef[right_len[z]] += coef[z];
        coef[z] = 0;
      }
      i = j;
      continue;
    }
    long long pos = get_mid_pos(((int)(lens).size()) - 1, k, left_len[i]);
    return pos + 2;
  }
  assert(0);
  return -1;
}
int main() {
  while (read()) {
    cout << solve() << "\n";
  }
  return 0;
}