#include <bits/stdc++.h>
int minus[105];
int main() {
  int w, h, a, b;
  scanf("%d %d", &w, &h);
  scanf("%d %d", &a, &b);
  minus[b] += a;
  scanf("%d %d", &a, &b);
  minus[b] += a;
  while (h > 0) {
    w += h;
    w -= minus[h];
    if (w < 0) w = 0;
    h--;
  }
  printf("%d", w);
  return 0;
}
