import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N,Q = MI() X = [] a,b = 0,0 c,d = 0,0 for _ in range(N): x,w = MI() X.append((x,w,0)) b += w d += x*w Y = LI() for i in range(Q): X.append((Y[i],0,i)) X.sort() ANS = [0]*Q for x,w,i in X: if w == 0: ANS[i] = x*(a-b)-(c-d) else: a += w b -= w c += x*w d -= x*w print(*ANS,sep='\n')