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>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
void solve(bool);
void precalc();
clock_t start;
int main() {
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  precalc();
  cout.precision(10);
  cout << fixed;
  int testNum = 1;
  while (t--) {
    solve(true);
  }
  cout.flush();
  return 0;
}
template <typename T>
T binpow(T q, T w, T mod) {
  if (!w) return 1 % mod;
  if (w & 1) return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}
template <typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template <typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}
void precalc() {}
template <typename T>
void relax_min(T& cur, T val) {
  cur = min(cur, val);
}
template <typename T>
void relax_max(T& cur, T val) {
  cur = max(cur, val);
}
vector<long long> sum(vector<long long> a, vector<long long> b,
                      long long sign) {
  vector<long long> res(a.size());
  for (long long i = 0; i < a.size(); ++i) {
    res[i] = a[i] + sign * b[i];
  }
  return res;
}
map<long long, long long> dp;
long long rec(long long n, long long dist) {
  if (n < 2 * dist - 1) {
    return 0;
  }
  if (dp.count(n)) {
    return dp[n];
  }
  long long lef = (n - 1) / 2, rig = n / 2;
  return dp[n] = 1 + rec(lef, dist) + rec(rig, dist);
}
long long rec_exactly(long long n, long long dist) {
  if (n < 2 * dist - 1) {
    return 0;
  }
  if (dp.count(n)) {
    return dp[n];
  }
  long long lef = (n - 1) / 2, rig = n / 2;
  long long have_current = (lef == dist - 1);
  return dp[n] = have_current + rec_exactly(lef, dist) + rec_exactly(rig, dist);
}
long long ANS = -1;
void find_ans(long long n, long long dist, long long num, long long add) {
  long long lef = (n - 1) / 2, rig = n / 2;
  long long have_current = (lef == dist - 1);
  if (dp[lef] >= num) {
    return find_ans(lef, dist, num, add);
  }
  num -= dp[lef];
  if (have_current) {
    --num;
  }
  if (num == 0) {
    ANS = add + lef;
    return;
  }
  return find_ans(rig, dist, num, add + lef + 1);
}
long long n;
long long get_segs(long long dist) {
  dp.clear();
  return rec(n, dist);
}
void solve(bool read) {
  long long k;
  if (read) {
    cin >> n >> k;
  } else {
    n = rand() % 30 + 1;
    k = rand() % n + 1;
    cout << n << " " << k << endl;
  }
  if (k == 1) {
    cout << 1 << endl;
    return;
  }
  if (k == 2) {
    cout << n << endl;
    return;
  }
  n -= 2;
  k -= 2;
  long long N = n, K = k;
  long long L = 0, R = n + 1;
  while (L + 1 < R) {
    long long M = (L + R) / 2;
    long long cur_val = get_segs(M);
    if (cur_val < k) {
      R = M;
    } else {
      L = M;
    }
  }
  long long dist = L;
  k -= get_segs(R);
  dp.clear();
  rec_exactly(n, dist);
  ANS = -1;
  find_ans(n, dist, k, 0);
  assert(ANS != -1);
  cout << ANS + 2 << endl;
  if (!read) {
    vector<long long> a(n, 0);
    for (long long i = 0; i < K; ++i) {
      long long min_dist = 0;
      long long mn = -1;
      for (long long j = 0; j < n; ++j) {
        long long cur_dist = min(j + 1, n - j);
        for (long long r = 0; r < n; ++r) {
          if (a[r]) {
            relax_min(cur_dist, abs(r - j));
          }
        }
        if (min_dist < cur_dist) {
          min_dist = cur_dist;
          mn = j;
        }
      }
      a[mn] = 1;
      if (i + 1 == K) {
        if (mn != ANS) {
          cout << "error: " << n << " " << K << " " << ANS << " " << mn << endl;
          exit(0);
        }
      }
    }
  }
}