#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, a, b, c, d;
  cin >> n >> m;
  cin >> a >> b;
  cin >> c >> d;
  for (int i = m; i >= 1; i--) {
    n += i;
    if (i == b) {
      n -= a;
      if (n < 0) n = 0;
    }
    if (i == d) {
      n -= c;
      if (n < 0) n = 0;
    }
  }
  cout << n << endl;
  return 0;
}
