It is easy to see that A−B=0. Indeed, we have A−B=0 if and only if the 27 sums are all equal; however, if x,y,z are three consecutive numbers on the circumference, the sums x+y and y+z are different, since x=z.
We will now prove that it is not possible that A−B=1. If this is the case, when considering three consecutive numbers x,y,z on the circumference, the sums x+y and y+z differ by 1, since they are not equal, and so, x and z differ by 1. Now look at the place where the number 27 is located; assume the previous numbers are a,b and the following are c,d.

By the previous arguments, 27 and d differ by 1, and the same happens with 27 and a. But the only written number that differs by 1 with 27 is 26; then, both a and d would be equal to 26, a contradiction. This proves that we cannot achieve A−B=1.
Finally, we show an example where A−B=2.
First, Lucía writes number 1 and then, she alternates odd and even numbers, writing odd numbers in decreasing order and even numbers in increasing order.
16

The first sum is 1+27=28 and, the following ones are alternately 29 and 27. Therefore, A−B=29−27=2, as stated.