#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int n, d;
  cin >> n >> d;
  int x[200] = {0};
  for (int i = 0; i < n; i++) cin >> x[i];
  set<int> ans;
  int y = 0;
  for (int i = 0; i < 2 * n; i++) {
    bool ok = 1;
    if (i % 2 == 0)
      y = x[i / 2] + d;
    else
      y = x[i / 2] - d;
    for (int j = 0; j < n; j++) {
      if (abs(x[j] - y) < d) {
        ok = 0;
        break;
      }
    }
    if (ok)
      ans.insert(y);
    else
      continue;
  }
  cout << ans.size() << endl;
  return 0;
}
