#include <bits/stdc++.h>
using namespace std;
const int M = 2e6 + 7;
const long long q = 7057594037927903;
const long long prime = 2137;
int n, m, wynik, tab[M], a, b;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &tab[i]);
  wynik = 2;
  for (int i = 1; i < n; i++) {
    a = tab[i] + m;
    if (tab[i + 1] - a >= m) wynik++;
    b = tab[i + 1] - m;
    if (b - tab[i] >= m && a != b) wynik++;
  }
  printf("%d", wynik);
  return 0;
}
