N,K=map(int,input().split());X=[*map(int,input().split())];W=[*map(int,input().split())] def f(b): if b<1:return N z=9e9 for i in range(N): if b&(1<