#include <bits/stdc++.h>
using namespace std;
int main() {
  int *arr;
  int d, c, t = 0;
  cin >> d >> c;
  arr = new int[d];
  for (int z = 0; z < d; z++) cin >> arr[z];
  for (int z = 0; z < d - 1; z++) {
    if (arr[z] > arr[z + 1]) {
      t = max(t, arr[z] - (arr[z + 1] + c));
    }
  }
  cout << t;
}
