Imports System

Module Test2
Sub Main()
Dim input As String, S_line(999) As Integer, Output As String
Dim  A_int As Integer, B_int As Integer
Dim PP As Integer, S_test() As String
Input ="" : Output ="" 
Input=Console.ReadLine()
Dim a As Integer, b As Integer
S_test = Split(Input, " ")
a = S_test(0)
b = S_test(1)
For A_int = 1 To 999 Step 1
PP = 0
For B_int = 1 To A_int Step 1
PP = PP + B_int
Next
S_line(A_int) = PP
Next
Dim Ck_a As Integer, Ck_b As Integer
For A_int = 1 To 998 Step 1
Ck_a = S_line(A_int) - a
Ck_b = S_line(A_int + 1) - b
If Ck_a = Ck_b Then Exit For
Next
Output = Ck_a.ToString
Console.WriteLine(Output)
End sub
End Module