import sys input = sys.stdin.readline N,Q = map(int,input().split()) XW = [tuple(map(int,input().split())) for i in range(N)] XW.sort(key=lambda x:x[0]) X = list(map(int,input().split())) lc = [0] wc = [0] for (px,pw),(x,_) in zip(XW,XW[1:]): wc.append(wc[-1] + pw) lc.append(lc[-1] + wc[-1] * (x-px)) wc.append(wc[-1] + XW[-1][1]) xs = [x for x,_ in XW] XW.reverse() rc = [0] w = 0 for (px,pw),(x,_) in zip(XW,XW[1:]): w += pw rc.append(rc[-1] + w * (px-x)) rc.reverse() from bisect import bisect ans = [] for x in X: i = bisect(xs, x) if i and xs[i-1] == x: ans.append(lc[i-1] + rc[i-1]) continue if i==0: ans.append(rc[0] + wc[-1]*(xs[0]-x)) continue if i==N: ans.append(lc[-1] + wc[-1]*(x-xs[-1])) continue l,r = x-xs[i-1], xs[i]-x v = lc[i-1] + rc[i] v += l*wc[i] + r*(wc[-1] - wc[i]) ans.append(v) print(*ans, sep='\n')