
def BinarySearchLowerBound(_arr, _ele): # arr is strictly increasing
    low_ind = 0
    up_ind = len(_arr) - 1
    if _arr[low_ind] >= _ele:
        return low_ind
    if _arr[up_ind] <= _ele:
        return up_ind + 1
    found = None
    while (up_ind - low_ind) > 1:
        mid = (up_ind + low_ind) / 2
        if _arr[mid] < _ele:
            low_ind = mid
        elif _arr[mid] > _ele:
            up_ind = mid
        elif _arr[mid] == _ele:
            found = mid
            break
    if found is not None:
        cnt = found
    else:
        cnt = up_ind
    return cnt

def solve():
    N, Q = [int(_) for _ in raw_input().split()]
    STX = []
    for i in range(N):
        Si, Ti, Xi = [int(_) for _ in raw_input().split()]
        STX.append((Si - Xi, Ti - Xi, Xi))
    D = []
    for i in range(Q):
        D.append(int(raw_input()))
    STX.sort(key = lambda x:x[2])
    # D have already been sorted based on settings on problem
    ans = [-1] * Q
    l = [None] * Q
    for i in range(N):
        Li, Ri, Xi = STX[i]
        if len(D) == 0:
            break
        lit = BinarySearchLowerBound(D, Li)
        rit = BinarySearchLowerBound(D, Ri)
        while lit < rit:
            if l[lit] is not None:
                lit = l[lit]
            else:
                ans[lit] = Xi
                l[lit] = rit
                lit += 1
    for i in range(Q):
        print ans[i]

if __name__ == '__main__':
    solve() def BinarySearchLowerBound(_arr, _ele): # arr is strictly increasing
    low_ind = 0
    up_ind = len(_arr) - 1
    if _arr[low_ind] >= _ele:
        return low_ind
    if _arr[up_ind] <= _ele:
        return up_ind + 1
    found = None
    while (up_ind - low_ind) > 1:
        mid = (up_ind + low_ind) / 2
        if _arr[mid] < _ele:
            low_ind = mid
        elif _arr[mid] > _ele:
            up_ind = mid
        elif _arr[mid] == _ele:
            found = mid
            break
    if found is not None:
        cnt = found
    else:
        cnt = up_ind
    return cnt BinarySearchLowerBound low_ind = 0 low_ind 0 up_ind = len(_arr) - 1 up_ind len(_arr) - 1 len(_arr) len _arr 1 if _arr[low_ind] >= _ele:
        return low_ind
     _arr[low_ind] >= _ele _arr[low_ind] _arr low_ind _ele return low_ind low_ind if _arr[up_ind] <= _ele:
        return up_ind + 1
     _arr[up_ind] <= _ele _arr[up_ind] _arr up_ind _ele return up_ind + 1 up_ind + 1 up_ind 1 found = None found None while (up_ind - low_ind) > 1:
        mid = (up_ind + low_ind) / 2
        if _arr[mid] < _ele:
            low_ind = mid
        elif _arr[mid] > _ele:
            up_ind = mid
        elif _arr[mid] == _ele:
            found = mid
            break
     (up_ind - low_ind) > 1 up_ind - low_ind up_ind low_ind 1 mid = (up_ind + low_ind) / 2 mid (up_ind + low_ind) / 2 up_ind + low_ind up_ind low_ind 2 if _arr[mid] < _ele:
            low_ind = mid
        elif _arr[mid] > _ele:
            up_ind = mid
        elif _arr[mid] == _ele:
            found = mid
            break
     _arr[mid] < _ele _arr[mid] _arr mid _ele low_ind = mid low_ind mid elif _arr[mid] > _ele:
            up_ind = mid
         _arr[mid] > _ele _arr[mid] _arr mid _ele up_ind = mid up_ind mid elif _arr[mid] == _ele:
            found = mid
            break
     _arr[mid] == _ele _arr[mid] _arr mid _ele found = mid found mid break if found is not None:
        cnt = found
    else:
        cnt = up_ind
     found is not None found None cnt = found cnt found cnt = up_ind cnt up_ind return cnt cnt _arr _arr _ele _ele def solve():
    N, Q = [int(_) for _ in raw_input().split()]
    STX = []
    for i in range(N):
        Si, Ti, Xi = [int(_) for _ in raw_input().split()]
        STX.append((Si - Xi, Ti - Xi, Xi))
    D = []
    for i in range(Q):
        D.append(int(raw_input()))
    STX.sort(key = lambda x:x[2])
    # D have already been sorted based on settings on problem
    ans = [-1] * Q
    l = [None] * Q
    for i in range(N):
        Li, Ri, Xi = STX[i]
        if len(D) == 0:
            break
        lit = BinarySearchLowerBound(D, Li)
        rit = BinarySearchLowerBound(D, Ri)
        while lit < rit:
            if l[lit] is not None:
                lit = l[lit]
            else:
                ans[lit] = Xi
                l[lit] = rit
                lit += 1
    for i in range(Q):
        print ans[i] solve int(_) for _ in raw_input().split() for _ in raw_input().split() _ raw_input().split() ().split () raw_input split for _ in raw_input().split() int(_) int _ N, Q = [int(_) for _ in raw_input().split()] N [int(_) for _ in raw_input().split()] Q STX = [] STX [] for i in range(N):
        Si, Ti, Xi = [int(_) for _ in raw_input().split()]
        STX.append((Si - Xi, Ti - Xi, Xi))
     i range(N) range N int(_) for _ in raw_input().split() for _ in raw_input().split() _ raw_input().split() ().split () raw_input split for _ in raw_input().split() int(_) int _ Si, Ti, Xi = [int(_) for _ in raw_input().split()] Si [int(_) for _ in raw_input().split()] Ti Xi STX.append((Si - Xi, Ti - Xi, Xi)) STX.append STX append (Si - Xi, Ti - Xi, Xi) Si - Xi Si Xi Ti - Xi Ti Xi Xi D = [] D [] for i in range(Q):
        D.append(int(raw_input()))
     i range(Q) range Q D.append(int(raw_input())) D.append D append int(raw_input()) int raw_input() raw_input STX.sort(key = lambda x:x[2]) STX.sort STX sort key = lambda x:x[2] key lambda x:x[2] x[2] x 2 x ans = [-1] * Q ans [-1] * Q [-1] -1 Q l = [None] * Q l [None] * Q [None] None Q for i in range(N):
        Li, Ri, Xi = STX[i]
        if len(D) == 0:
            break
        lit = BinarySearchLowerBound(D, Li)
        rit = BinarySearchLowerBound(D, Ri)
        while lit < rit:
            if l[lit] is not None:
                lit = l[lit]
            else:
                ans[lit] = Xi
                l[lit] = rit
                lit += 1
     i range(N) range N Li, Ri, Xi = STX[i] Li STX[i] STX i Ri Xi if len(D) == 0:
            break
         len(D) == 0 len(D) len D 0 break lit = BinarySearchLowerBound(D, Li) lit BinarySearchLowerBound(D, Li) BinarySearchLowerBound D Li rit = BinarySearchLowerBound(D, Ri) rit BinarySearchLowerBound(D, Ri) BinarySearchLowerBound D Ri while lit < rit:
            if l[lit] is not None:
                lit = l[lit]
            else:
                ans[lit] = Xi
                l[lit] = rit
                lit += 1
     lit < rit lit rit if l[lit] is not None:
                lit = l[lit]
            else:
                ans[lit] = Xi
                l[lit] = rit
                lit += 1
     l[lit] is not None l[lit] l lit None lit = l[lit] lit l[lit] l lit ans[lit] = Xi ans[lit] ans lit Xi l[lit] = rit l[lit] l lit rit lit += 1 lit 1 for i in range(Q):
        print ans[i] i range(Q) range Q print ans[i] ans i if __name__ == '__main__':
    solve() __name__ == '__main__' __name__ '__main__' solve() solve def solve():
    N, Q = [int(_) for _ in raw_input().split()]
    STX = []
    for i in range(N):
        Si, Ti, Xi = [int(_) for _ in raw_input().split()]
        STX.append((Si - Xi, Ti - Xi, Xi))
    D = []
    for i in range(Q):
        D.append(int(raw_input()))
    STX.sort(key = lambda x:x[2])
    # D have already been sorted based on settings on problem
    ans = [-1] * Q
    l = [None] * Q
    for i in range(N):
        Li, Ri, Xi = STX[i]
        if len(D) == 0:
            break
        lit = BinarySearchLowerBound(D, Li)
        rit = BinarySearchLowerBound(D, Ri)
        while lit < rit:
            if l[lit] is not None:
                lit = l[lit]
            else:
                ans[lit] = Xi
                l[lit] = rit
                lit += 1
    for i in range(Q):
        print ans[i] def solve():
    N, Q = [int(_) for _ in raw_input().split()]
    STX = []
    for i in range(N):
        Si, Ti, Xi = [int(_) for _ in raw_input().split()]
        STX.append((Si - Xi, Ti - Xi, Xi))
    D = []
    for i in range(Q):
        D.append(int(raw_input()))
    STX.sort(key = lambda x:x[2])
    # D have already been sorted based on settings on problem
    ans = [-1] * Q
    l = [None] * Q
    for i in range(N):
        Li, Ri, Xi = STX[i]
        if len(D) == 0:
            break
        lit = BinarySearchLowerBound(D, Li)
        rit = BinarySearchLowerBound(D, Ri)
        while lit < rit:
            if l[lit] is not None:
                lit = l[lit]
            else:
                ans[lit] = Xi
                l[lit] = rit
                lit += 1
    for i in range(Q):
        print ans[i] solve def BinarySearchLowerBound(_arr, _ele): # arr is strictly increasing
    low_ind = 0
    up_ind = len(_arr) - 1
    if _arr[low_ind] >= _ele:
        return low_ind
    if _arr[up_ind] <= _ele:
        return up_ind + 1
    found = None
    while (up_ind - low_ind) > 1:
        mid = (up_ind + low_ind) / 2
        if _arr[mid] < _ele:
            low_ind = mid
        elif _arr[mid] > _ele:
            up_ind = mid
        elif _arr[mid] == _ele:
            found = mid
            break
    if found is not None:
        cnt = found
    else:
        cnt = up_ind
    return cnt def BinarySearchLowerBound(_arr, _ele): # arr is strictly increasing
    low_ind = 0
    up_ind = len(_arr) - 1
    if _arr[low_ind] >= _ele:
        return low_ind
    if _arr[up_ind] <= _ele:
        return up_ind + 1
    found = None
    while (up_ind - low_ind) > 1:
        mid = (up_ind + low_ind) / 2
        if _arr[mid] < _ele:
            low_ind = mid
        elif _arr[mid] > _ele:
            up_ind = mid
        elif _arr[mid] == _ele:
            found = mid
            break
    if found is not None:
        cnt = found
    else:
        cnt = up_ind
    return cnt BinarySearchLowerBound

def BinarySearchLowerBound(_arr, _ele): # arr is strictly increasing
    low_ind = 0
    up_ind = len(_arr) - 1
    if _arr[low_ind] >= _ele:
        return low_ind
    if _arr[up_ind] <= _ele:
        return up_ind + 1
    found = None
    while (up_ind - low_ind) > 1:
        mid = (up_ind + low_ind) / 2
        if _arr[mid] < _ele:
            low_ind = mid
        elif _arr[mid] > _ele:
            up_ind = mid
        elif _arr[mid] == _ele:
            found = mid
            break
    if found is not None:
        cnt = found
    else:
        cnt = up_ind
    return cnt

def solve():
    N, Q = [int(_) for _ in raw_input().split()]
    STX = []
    for i in range(N):
        Si, Ti, Xi = [int(_) for _ in raw_input().split()]
        STX.append((Si - Xi, Ti - Xi, Xi))
    D = []
    for i in range(Q):
        D.append(int(raw_input()))
    STX.sort(key = lambda x:x[2])
    # D have already been sorted based on settings on problem
    ans = [-1] * Q
    l = [None] * Q
    for i in range(N):
        Li, Ri, Xi = STX[i]
        if len(D) == 0:
            break
        lit = BinarySearchLowerBound(D, Li)
        rit = BinarySearchLowerBound(D, Ri)
        while lit < rit:
            if l[lit] is not None:
                lit = l[lit]
            else:
                ans[lit] = Xi
                l[lit] = rit
                lit += 1
    for i in range(Q):
        print ans[i]

if __name__ == '__main__':
    solve()
