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, m;
bool work(long long x, long long c0, long long c1, long long rm, long long q0,
          long long q1, long long qr, pair<long long, long long> s) {
  if (x == 2) {
    if (rm <= c1) {
      long long p = (s.first - 1) / 2 + s.second;
      if (p <= qr) {
        if (s.first == x)
          ++q0;
        else
          ++q1;
      }
      return rm <= q1;
    }
    map<long long, long long> ms;
    ms[x] += c0;
    ms[x / 2] += c1;
    ms[(x + 1) / 2] += c1;
    long long pp = 1, X = ms[pp], Y = ms[pp + 1];
    ms.clear();
    ms[x] += q0;
    ms[x / 2] += q1;
    ms[(x + 1) / 2] += q1;
    long long Z = ms[pp], W = ms[pp + 1];
    ms.clear();
    if (s.first == 3) {
      pair<long long, long long> A((s.first - 1) / 2, s.second),
          B(s.first / 2, s.second + (s.first + 1) / 2);
      if (B.second > qr)
        s = A;
      else {
        s = B;
        if (A.first == pp)
          ++Z;
        else
          ++W;
      }
    }
    return work(pp, X, Y, rm - c1, Z, W, qr, s);
  }
  if (x == 1 && c1) {
    c0 += c1 * 2;
    c1 = 0;
    q0 += q1 * 2;
    q1 = 0;
    if (s.first == 2) {
      pair<long long, long long> A(1, s.second), B(1, s.second + 1);
      if (B.second > qr)
        s = A;
      else
        s = B, ++q0;
    }
    return work(1, c0, 0, rm, q0, 0, qr, s);
  }
  if (rm <= c0 + c1) {
    long long p = (s.first - 1) / 2 + s.second;
    if (p <= qr) {
      if (s.first == x)
        ++q0;
      else
        ++q1;
    }
    if (x % 2 == 0) {
      if (rm <= c1) return rm <= q1;
      return rm - c1 <= q0;
    }
    return rm <= q0 + q1;
  }
  map<long long, long long> ms;
  ms[(x - 1) / 2] += c0;
  ms[x / 2] += c0;
  ms[x / 2] += c1;
  ms[(x + 1) / 2] += c1;
  long long pp;
  for (map<long long, long long>::iterator g = ms.begin(); g != ms.end(); ++g)
    if (g->second) {
      pp = g->first;
      break;
    }
  long long X = ms[pp], Y = ms[pp + 1];
  ms.clear();
  ms[(x - 1) / 2] += q0;
  ms[x / 2] += q0;
  ms[x / 2] += q1;
  ms[(x + 1) / 2] += q1;
  long long Z = ms[pp], W = ms[pp + 1];
  ms.clear();
  pair<long long, long long> A((s.first - 1) / 2, s.second),
      B(s.first / 2, s.second + (s.first + 1) / 2);
  if (B.second > qr)
    s = A;
  else {
    s = B;
    if (A.first == pp)
      ++Z;
    else
      ++W;
  }
  return work(pp, X, Y, rm - c0 - c1, Z, W, qr, s);
}
bool ok(long long s) {
  return work(n - 2, 1, 0, m, 0, 0, s, pair<long long, long long>(n - 2, 2));
}
int main() {
  scanf("%lld%lld", &n, &m);
  if (m == 1) {
    puts("1");
    return 0;
  }
  if (m == 2) {
    printf("%lld\n", n);
    return 0;
  }
  m -= 2;
  long long l = 2, r = n - 1;
  while (l < r) {
    long long g = (l + r) >> 1;
    if (ok(g))
      r = g;
    else
      l = g + 1;
  }
  printf("%lld\n", l);
}