#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, i, e, f, g, n, m, k, l, r, ans, a2, b2, a3, b3;
pair<int, pair<int, int> > A[100005];
string s[100005];
map<int, int> mp, mp2;
int main() {
  cin >> a >> b;
  cin >> a2 >> b2;
  cin >> a3 >> b3;
  for (long long i = b; i >= 1; i--) {
    if (a < 0) a = 0;
    a += i;
    if (i == b2)
      a -= a2;
    else if (i == b3)
      a -= a3;
  }
  if (a < 0)
    cout << 0;
  else
    cout << a;
}
