The ICM ACPC World Finals is coming! Unfortunately, the organizers of the competition were so busy preparing tasks that totally missed an important technical point — the organization of electricity supplement for all the participants workstations.

There are *n* computers for participants, the *i*-th of which has power equal to positive integer *p*<sub class="lower-index">*i*</sub>. At the same time there are *m* sockets available, the *j*-th of which has power euqal to positive integer *s*<sub class="lower-index">*j*</sub>. It is possible to connect the *i*-th computer to the *j*-th socket if and only if their powers are the same: *p*<sub class="lower-index">*i*</sub> = *s*<sub class="lower-index">*j*</sub>. It is allowed to connect no more than one computer to one socket. Thus, if the powers of all computers and sockets are distinct, then no computer can be connected to any of the sockets. 

In order to fix the situation professor Puch Williams urgently ordered a wagon of adapters — power splitters. Each adapter has one plug and one socket with a voltage divider between them. After plugging an adapter to a socket with power *x*, the power on the adapter's socket becomes equal to <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/f12f73ab57d327f2f2cb7c8de54e8e6e246f6b2e.png" style="max-width: 100.0%;max-height: 100.0%;"/>, it means that it is equal to the socket's power divided by two with rounding up, for example <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/76bfa25c99d0b55a7a771e94e81663797271f0c7.png" style="max-width: 100.0%;max-height: 100.0%;"/> and <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/6e981410b6288893640ae21ef007a1fd60c8ab1f.png" style="max-width: 100.0%;max-height: 100.0%;"/>.

Each adapter can be used only once. It is possible to connect several adapters in a chain plugging the first to a socket. For example, if two adapters are plugged one after enother to a socket with power 10, it becomes possible to connect one computer with power 3 to this socket.

The organizers should install adapters so that it will be possible to supply with electricity the maximum number of computers *c* at the same time. If there are several possible connection configurations, they want to find the one that uses the minimum number of adapters *u* to connect *c* computers.

Help organizers calculate the maximum number of connected computers *c* and the minimum number of adapters *u* needed for this.

The wagon of adapters contains enough of them to do the task. It is guaranteed that it's possible to connect at least one computer.
The first line contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 200 000) — the number of computers and the number of sockets.

The second line contains *n* integers *p*<sub class="lower-index">1</sub>, *p*<sub class="lower-index">2</sub>, ..., *p*<sub class="lower-index">*n*</sub> (1 ≤ *p*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) — the powers of the computers. 

The third line contains *m* integers *s*<sub class="lower-index">1</sub>, *s*<sub class="lower-index">2</sub>, ..., *s*<sub class="lower-index">*m*</sub> (1 ≤ *s*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) — the power of the sockets.
none
2 2
1 1
2 2
2 2
1 1
1 2
2 1
2 100
99
1 6
6
1 0
1 1
1
1
1 0
0
1
2 1
2 570129
753393670
1 29
29
1 0
1 2
258
270411237 421787464
1 20
20 0
1
2 2
607578 103023
185480405 843960081
1 13
0 13
0 2
7 14
3001266 412 1 6352768 8464826 377123633 47905
754247265 394532939 770046583 653892313 683423733 954533833 49604822 768323920 915021669 957143548 958842438 215985395 436153649 784873711
5 68
1 0 0 0 0 0 26 8 0 0 0 19 0 14
8 12 7 0 0 1 14
20 6
324808990 694282896 520370119 517339237 249359185 819827071 836664188 76139629 244199124 859108203 814663867 990442180 691917477 27941652 77863315 303453003 127803150 902014007 4 9889
280249976 516845282 648041227 501870516 331037759 269068401
2 43
0 0 16 27 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 3
20 20
358327 61255 12574 9380 648412 27 60308 161816 959334 3323307 57728 14362672 407549 919521 304966 903649 183517838 137 343976 707862
385844885 411993472 662795782 682392195 420983806 236452620 212691602 367035675 542587750 793595102 417329702 210900246 286770075 128917988 494041151 229802747 164905921 109491119 981875934 337128745
10 116
0 15 12 0 0 12 6 1 0 0 10 0 21 0 13 4 0 22 0 0
0 0 2 0 0 18 15 3 0 7 6 16 11 0 0 0 8 13 0 0
12 20
673751 364358 11 569147 4743 872206 139438 573283 424256 1446 43981 119128
835584295 255782087 822018911 771649013 621621692 505282732 552293130 993930709 587169173 273568178 123207358 575541287 352014954 690005410 571134122 681872675 757895271 172751211 650124600 393178774
4 72
0 0 0 0 17 0 0 0 0 0 0 0 0 0 12 0 19 24 0 0
0 0 18 0 5 0 15 0 0 17 0 0
17 19
2 4 5 2 1 2 3 3 3 4 1 1 2 3 4 2 4
999999998 999999998 1000000000 1000000000 999999996 999999998 999999999 1000000000 999999999 999999996 999999996 999999998 1000000000 999999997 999999999 999999996 1000000000 999999996 1000000000
12 347
29 29 0 0 28 29 30 0 30 28 28 30 0 29 0 28 0 29 0
18 5 0 14 12 1 0 0 0 10 7 9 2 0 11 6 16
18 16
4 4 10 2 8 2 5 2 7 2 1 3 10 8 2 7 1 7
999999990 999999939 999999987 999999980 999999913 999999934 999999992 999999915 999999985 999999942 999999946 999999931 999999917 999999923 999999929 999999902
11 315
0 29 0 0 27 29 0 28 0 30 30 29 28 29 29 27
8 13 0 14 16 15 0 12 0 6 10 0 0 5 2 0 11 0
10 20
92004 532907 4 483 975386 12721 298085 98 407776 82592864
405840200 505732458 951128293 660742906 376845577 590033550 833632727 9301018 200803969 843977787 841335596 177264092 410815195 696181563 73521741 834528337 107557963 610477119 918083019 214974686
7 109
0 20 0 3 12 0 16 0 0 0 0 0 22 0 0 0 25 11 0 0
5 0 17 2 0 7 18 13 0 4
2 2
9 17
33 36
2 3
1 2
2 1
import sys 
input = sys.stdin.buffer.readline 

def process(P, S):
    n = len(P)
    m = len(S)
    L1 = []
    for i in range(n):
        pi = P[i]
        L1.append((pi, i))
    L1.sort()
    L2 = []
    for i in range(m):
        x = S[i]
        c = 0
        while True:
            L2.append((x, -1*c, i))
            if x==1:
                break
            if x % 2==0:
                x = x//2 
            else:
                x = x//2+1 
            c+=1
    L2.sort()
    answer1 = [None for i in range(m)]
    answer2 = [0 for i in range(n)]
    while len(L1) > 0 and len(L2) > 0:
        pi, i1 = L1[-1]
        x, c, i2 = L2[-1]
        c = -1*c
        if pi > x:
            L1.pop()
        elif x > pi:
            L2.pop()
        elif answer1[i2] is not None:
            L2.pop()
        else:
            answer1[i2] = c 
            answer2[i1] = i2+1
    c = 0 
    for i in range(n):
        if answer2[i] > 0:
            c+=1 
    for i in range(m):
        if answer1[i] is None:
            answer1[i] = 0 
    u = sum(answer1)
    sys.stdout.write(f'{c} {u}\n')
    answer1 = ' '.join(map(str, answer1))
    answer2 = ' '.join(map(str, answer2))
    sys.stdout.write(f'{answer1}\n')
    sys.stdout.write(f'{answer2}\n')
        
            
            
n, m = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
S = [int(x) for x in input().split()]
process(P, S)