#include <bits/stdc++.h>
using namespace std;
unsigned long long int PowMod(unsigned long long int n) {
  unsigned long long int ret = 1;
  unsigned long long int a = 2;
  while (n > 0) {
    if (n & 1) ret = ((ret % 1000000007) * (a % 1000000007)) % 1000000007;
    a = ((a % 1000000007) * (a % 1000000007)) % 1000000007;
    n >>= 1;
  }
  return ret;
}
int gcd(int a, int b) {
  if (a == 0) return b;
  if (b == 0) return a;
  if (a < 0) return gcd(-1 * a, b);
  if (b < 0) return gcd(a, -1 * b);
  if (a > b) return gcd(b, a);
  return gcd(b % a, a);
}
struct node {
  int val;
  node* left;
  node* right;
};
int main() {
  long long int n, d;
  cin >> n >> d;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long int answer = 0;
  set<int> s;
  s.insert(a[0] - d);
  s.insert(a[n - 1] + d);
  int t;
  if (n != 1) {
    for (int i = 0; i < n; i++) {
      if (i == 0) {
        t = a[i] + d;
        if (a[i + 1] - t >= d) {
          if (s.find(t) == s.end()) s.insert(t);
        }
      } else if (i > 0 && i < n - 1) {
        t = a[i] - d;
        if (t - a[i - 1] >= d) {
          if (s.find(t) == s.end()) s.insert(t);
        }
        t = a[i] + d;
        if (a[i + 1] - t >= d) {
          if (s.find(t) == s.end()) s.insert(t);
        }
      } else {
        t = a[i] - d;
        if (t - a[i - 1] >= d) {
          if (s.find(t) == s.end()) s.insert(t);
        }
      }
    }
  }
  answer = s.size();
  cout << answer << endl;
}
