#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200;
int ww[MAXN];
int main() {
  int h, w;
  cin >> w >> h;
  for (int i = 0; i < 2; i++) {
    int wei, hh;
    cin >> wei >> hh;
    ww[hh] = wei;
  }
  for (int i = h; i >= 0; i--) {
    w += i;
    w -= ww[i];
    if (w < 0) w = 0;
  }
  cout << w << endl;
  return 0;
}
