#include <bits/stdc++.h>
using namespace std;
int n, c, a[2], r = 0;
int main() {
  cin >> n >> c >> a[0];
  for (int i = 1; i < n; i++)
    cin >> a[i % 2], r = max(r, a[i % 2 ^ 1] - a[i % 2] - c);
  cout << r;
}
