#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, arr[100], count = 2, i;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (i = 1; i < n; i++) {
    int r = arr[i] - m;
    int l = arr[i - 1] + m;
    if (l == r) {
      count += 1;
    } else if (l < r) {
      count += 2;
    }
  }
  cout << count << endl;
  return 0;
}
