#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int maxn = 1e5 + 10,
          INFll = 0x7fffffffffffffffll;
int n;
ll dp[maxn], C, last, Max = -INFll;

int main() {
	scanf("%d %lld", &n, &C);
	for (int i = 1; i <= n; i++) {
		int x, y;
		scanf("%lld %d", &x, &y);
		dp[i] = dp[i - 1] + last - x + y;
		last = x;
	}
	for (int i = 1; i <= n; i++)
		Max = max(Max, dp[i]);
	return printf("%lld", Max);
}