#include <bits/stdc++.h>
using namespace std;
struct debugger {
  static void call(string::iterator it, string::iterator ed) {}
  template <typename T, typename... aT>
  static void call(string::iterator it, string::iterator ed, T a, aT... rest) {
    string b;
    for (; *it != ','; ++it)
      if (*it != ' ') b += *it;
    cout << b << "=" << a << " ";
    call(++it, ed, rest...);
  }
};
int main() {
  long n, d;
  cin >> n >> d;
  vector<long> arr(n);
  set<long> p;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  if (n == 1) {
    cout << "2";
    return 0;
  }
  if ((arr[0] + d) <= arr[1] - d) {
    p.insert(arr[0] + d);
  }
  long i;
  for (i = 1; i < n; i++) {
    if ((arr[i] - d) >= (arr[i - 1] + d)) {
      p.insert(arr[i] - d);
    }
    if ((arr[i] + d) <= (arr[i + 1] - d) && i != (n - 1)) {
      p.insert(arr[i] + d);
    }
  }
  p.insert(arr[i] + d);
  cout << p.size() + 1;
}
