406082: GYM102263 D Meeting Bahosain
Description
Essa wanted to meet the most powerful number theorist of all time: Bahosain, but Bahosain does not waste his precious time, so he gave Essa this puzzle in order to test his abilities.
Given two arrays, the second array only has distinct elements, Essa can do the following as many times as he wants to make all numbers in first array equal.
- Choose a number from the first array
- Add or subtract from it a number in the second array
- Replace the number in the first array with the result
The first line containing two space separated integers $$$n,m$$$ ($$$1\le n,k \le 10^6$$$) represent the length of the first and second array.
the second line contains n integers represent the first array ($$$1\le a[i] \le 10^9$$$)
the third line contains m integers represent the second array ($$$1\le b[i] \le 10^9$$$)
OutputPrint Yes, if it's possible to make all numbers in first array equal; and No in the opposite case.
ExampleInput5 2 3 6 7 2 5 2 4Output
No