inf = open("dunes.in", "r")
ouf = open("dunes.out", "w")

n, m = map(int, inf.readline().split())
wind = []
for i in range(n):
    l, r, x = map(int, inf.readline().split())
    wind.append((l, r, x))

for i in range(m):
    v = int(inf.readline())
    s = 0
    for l, r, x in wind:
        if l <= v <= r:
            s += x if (v - l) % 2 == 0 else -x
    print(s, file = ouf)

inf.close()
ouf.close()

