#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, C;
  scanf("%d %d", &N, &C);
  long v = 0;
  long current_x = 0;
  long before_x = 0;
  long c[N];
  long d[N];
  for (int i = 0; i < N; ++i) {
    scanf("%ld %ld", &current_x, &v);
    c[i] = v - (current_x - before_x);
    d[i] = (i == 0) ? c[0] : d[i - 1] + c[i];
    before_x = current_x;
  }
  long ans = *max_element(d, d + N);
  if (ans > 0) {
    printf("%ld\n", ans);
  } else {
    printf("0\n");
  }
  return 0;
}
