Trivial? Solve It!
You are given an array of integers . Your task is to process queries:
add an integer to all elements of the array.
After each query, output the greatest common divisor of all elements of the array.
Input
The first line contains two integers , () — the size of the array and the number of queries, respectively.
The second line contains integers () — the elements of the array .
Each of the next lines contains one integer ().
Output
Output numbers — the greatest common divisor of the elements of the array after each addition.
Examples
Note
After the first query because was added to each element. The greatest common divisor in it is .
After the second query because was added to each element. The greatest common divisor in it is .
After the third query because was added to each element. The greatest common divisor in it is .
Scoring
In this problem, there are conditional blocks. If your solution works correctly for certain constraints, it will receive a certain number of points. Note that the evaluation is still in the testing phase.
( points): ;
( points): ;
( points): the number of different elements among is no more than ;
( points): without additional constraints.