#include <bits/stdc++.h>
using namespace std;
int main() {
  long long r, S, Z, s1, s2, s3, s4, s5, s6, x, y, z, n, m, i, j, l, k, t;
  long long a[150001];
  long long b[150001];
  long long c[100001];
  long long d[100001];
  string q;
  string s;
  string sq[3001];
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  x = 0;
  for (i = 1; i < n; i++) {
    b[i] = a[i + 1] - a[i];
    if (b[i] < 0) b[i] = b[i] * (-1);
    if (b[i] == 2 * m) x++;
    if (b[i] > 2 * m) x = x + 2;
  }
  x = x + 2;
  cout << x;
}
