#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, ans = 1;
  cin >> n >> a;
  vector<int> X;
  vector<int> O;
  for (; n > 0; --n) {
    if (n % 2 == 0)
      X.push_back(n);
    else
      O.push_back(n);
  }
  reverse(O.begin(), O.end());
  if (a % 2 == 0) {
    for (int i = 0; i < X.size(); ++i) {
      if (X[i] != a)
        ++ans;
      else
        break;
    }
  } else {
    for (int i = 0; i < O.size(); ++i) {
      if (O[i] != a)
        ++ans;
      else
        break;
    }
  }
  cout << ans;
}
