Flatland is a two dimensional world whose creatures live with a long list of handicaps. Even so, they recently reached wireless technology. The priest circles, the governors who kill anyone preaching the third dimension on sight, declared the national motto "Wireless technology is our indisputable right!" and formed a wireless spreading committee to connect every important point of Flatland by wireless antennas.
Everything went well until the committee reached the mountainous region. This region is a horizontal base line covered by a contiguous series of mountains. Each mountain is a right angled isosceles triangle with its base on the base line and its right angle at the peak. Only two kinds of mountains stand there, those of height 50 and those of height 100.
The committee installed its antennas on the points it had planned in advance. Only after the work was done did it turn out that two antennas communicate directly only when the segment joining them crosses no obstacle, which here means no mountain. Two antennas still communicate when the segment touches nothing but the border of an obstacle.
Removing an antenna in Flatland is as deadly a sin as "chromatization", so the only way to connect the installed antennas is to put extra antennas on suitable points of the mountains. A wireless antenna relays messages, so it links antennas that cannot talk directly. To keep the extra installation cheap, the committee hired you to find the minimum number of antennas that must be added.
In the figure below the four diamond shaped points are the antennas already installed. Placing three new antennas at the circle shaped points connects the whole set.

The input holds several test cases. The first line of each test case contains the number of mountains n (1≤n≤500) and the number of already installed antennas m (1≤m≤10000). The second line contains the heights h1,h2,…,hn (hi∈{50,100}) of the mountains on the base line from left to right. The third line contains the positions of the m antennas that are already installed. Each position is given by its x coordinate, taking the leftmost point of the leftmost mountain as the origin. Every antenna sits on the border of a mountain, so you can compute its y coordinate yourself.
The last line of the input is 0 0 and is not a test case.
The first example input describes the terrain drawn in the figure above.
For each test case print on a single line the minimum number of extra wireless antennas needed to make the given set of antennas connected.