Milestone Counter

Match the recorded pass times against milestone positions to count feasible speeds and list each possible first gap.

Easy3Brute forceMathInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

Driving along an Irish country road you pass small grey stones set by the wayside, spaced about a mile apart. They are milestones, put there to mark distance. All of them are old, some went missing over the years, and only part of the original line still stands.

You drive at a constant speed and pass MM of the remaining milestones in a row, writing down the time at which you pass each one. You do not know your own speed, but you do know where all NN remaining milestones sit along the road. That record is enough to work out how fast you were going.

Write the recorded times as T1<T2<<TMT_1 < T_2 < \dots < T_M and the milestone positions as X1<X2<<XNX_1 < X_2 < \dots < X_N. A speed vv is possible when some start index jj satisfies

Xj+i1Xj=v(TiT1)X_{j+i-1} - X_j = v\,(T_i - T_1)

for every i=1,2,,Mi = 1, 2, \dots, M. Speed is measured in miles per hour.

Find how many distinct speeds are possible, and for each of them the distance between the first milestone you passed and the second one.

Input

The first line has two integers MM and NN (2MN1032 \le M \le N \le 10^3): the number of milestones you passed in a row, and the total number of milestones left along the road.

The second line has the times T1,T2,,TMT_1, T_2, \dots, T_M in hours at which you passed a milestone, in increasing order. The values are distinct and 0Ti10150 \le T_i \le 10^{15}.

The third line has the positions X1,X2,,XNX_1, X_2, \dots, X_N of the milestones in miles, in increasing order. The values are distinct and 0Xi10150 \le X_i \le 10^{15}.

Output

Print two lines.

On the first line print the number of distinct speeds the car could have been travelling at.

On the second line print every possible distance between the first milestone you passed and the second one, in increasing order and separated by single spaces. Leave the second line empty when no speed is possible.