Laundry

No attempts yetTime limit3sMemory limit128 MB

Problem

A few friends decided to do their laundry together. They are all very tidy, so on each day every friend wears one clean pair of socks and one clean shirt. All of their dirty socks and shirts have now been washed, and they want to hang everything up to dry with clothespins.

They agreed on the following rules:

  • every sock is fastened to the line with a single clothespin;
  • every shirt is fastened with three clothespins;
  • all clothespins used on one person's socks must have the same color;
  • all clothespins used on one person's shirts must have the same color;
  • clothes belonging to different people must not use clothespins of the same color;
  • subject to all of the above, they want to use as few distinct clothespin colors as possible.

If friend ii collected laundry for did_i days, that friend has did_i pairs of socks and did_i shirts, and therefore needs 2di2 \cdot d_i clothespins for the socks (all of one color) and 3di3 \cdot d_i clothespins for the shirts (all of one color). A person may use the same color for both their socks and their shirts, or two different colors.

The friends have gathered all their clothespins and counted how many they have of each color. Help them find the smallest number of distinct colors they need to use.

Input

The first line contains two integers nn and kk (2n,k1,000,0002 \le n, k \le 1{,}000{,}000) — the number of friends and the number of available clothespin colors.

The second line contains nn integers d1,d2,,dnd_1, d_2, \ldots, d_n (1di1,000,0001 \le d_i \le 1{,}000{,}000), where did_i is the number of days friend ii was collecting laundry.

The third line contains kk integers l1,l2,,lkl_1, l_2, \ldots, l_k (1li4,000,0001 \le l_i \le 4{,}000{,}000), where lil_i is the number of clothespins of the ii-th color.

Output

Print a single integer: the minimum number of distinct clothespin colors needed to hang up all the laundry according to the rules. If it is impossible, print the single word NIE instead.

Notes

In the first example there are two friends. The first friend (d1=3d_1 = 3) needs 66 clothespins for socks and 99 for shirts; the second friend (d2=4d_2 = 4) needs 88 for socks and 1212 for shirts. Since 8+12=208 + 12 = 20, the second friend can use the first color (which has 2020 clothespins) for both socks and shirts. The first friend can then use, for example, the second and the fourth colors (each with 1010 clothespins) — one for the socks and one for the shirts. Three colors are used in total.