#include <bits/stdc++.h>
using namespace std;
const long long N = 105;
long long n, d, ans = 0;
long long a[N];
set<long long> s;
long long work() {
  set<long long> have;
  for (auto it : s) {
    long long dist = 2e9;
    for (long long i = 1; i <= n; i++) {
      if (abs(a[i] - it) < dist) dist = abs(a[i] - it);
    }
    if (dist == d) have.insert(it);
  }
  return have.size();
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> d;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    s.insert(a[i] - d);
    s.insert(a[i] + d);
  }
  long long ans = work();
  cout << ans;
  return 0;
}
