N,Q = map(int,input().split()) x = [0] w = [0] for i in range(N): a,b=map(int,input().split()) x.append(a) w.append(b) X = list(map(int,input().split())) Sxw = [0] Sw = [0] for i in range(N+1): Sxw.append(Sxw[i]+x[i]*w[i]) Sw.append(Sw[i]+w[i]) k = 0 for q in range(Q): while k<=N and X[q]>=x[k]: k+=1 print(Sxw[N+1]-2*Sxw[k]+X[q]*(2*Sw[k]-Sw[N+1]))