Barbells

Given up to 14 bars and 14 plates, find every total weight obtainable by putting plates on both sides of one bar so that the two sides balance.

Medium6Brute forceHash mapDynamic programmingCombinatoricsNo attempts yetTime limit2sMemory limit512 MB

Problem

The gym down the street has bb bars and pp plates. To prepare a weight for lifting you pick one bar and load plates onto its two sides. The set of plates on a side may be empty. For safety the two sides must balance: their plate weights have to sum to the same value. The plates on one side may differ from the plates on the other side, as long as the two sums are equal.

Each plate can be used at most once, and any plate may be left unused. The lifting weight is the weight of the bar plus the weight of all plates loaded on both sides. Find every weight that is available for lifting.

Input

The first line contains two integers bb and pp (1b,p141 \le b, p \le 14), the number of bars and the number of plates. Each of the next bb lines contains one integer xx (1x1081 \le x \le 10^8), the weight of a bar. Each of the following pp lines contains one integer yy (1y1081 \le y \le 10^8), the weight of a plate.

Output

Print every available lifting weight in increasing order, one per line. Do not print the same weight twice.