function StoneMonument(input) {
    input = input.split("\n");
    tmp = input[0].split(" ");
    var a = parseInt(tmp[0], 10);
    var b = parseInt(tmp[1], 10);
    var aa=[0];
    for(var i=1;i<=999;i++){
        aa[i]=i+aa[i-1];
    }
    for(var j=0;j<499500;j++){
        for(var i=j;i<999;i++){
            if(j > b)
                continue;
            if((aa[i-1]-j)==a && (aa[i]-j)==b){
                console.log(j);
                break;
            }
        }
    }
}
StoneMonument(require("fs").readFileSync("/dev/stdin", "utf8"));