#include <bits/stdc++.h>
using namespace std;
void useFileInput() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
void setMyPrecision(int n) { cout << fixed << setprecision(n); }
bool test = 0;
bool fileInput = 0;
void solve() {
  int n;
  long long d;
  cin >> n >> d;
  unordered_set<long long> poss;
  long long h[n];
  for (int i = 0; i < n; i++) cin >> h[i];
  for (int i = 0; i < n; i++) {
    long long ps1, ps2;
    ps1 = h[i] - d;
    ps2 = h[i] + d;
    if (i != 0) {
      if (abs((ps1 - h[i - 1])) >= d) poss.insert(ps1);
      if (abs((h[i + 1] - ps2) >= d) && i < n - 1) poss.insert(ps2);
      if (i == n - 1) poss.insert(ps2);
    } else {
      poss.insert(ps1);
      if (abs((h[i + 1] - ps2)) >= d) poss.insert(ps2);
    }
  }
  cout << poss.size();
}
int main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  if (fileInput) useFileInput();
  if (test) {
    int t;
    cin >> t;
    while (t--) solve();
  } else
    solve();
  return 0;
}
