output_description: Print Q lines. The i-th line should contain the distance the i-th person will
  walk or -1 if that person walks forever.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N Q
      S_1 T_1 X_1
      :
      S_N T_N X_N
      D_1
      :
      D_Q
attempt: import bisect
  
  
  class LazyPropSegmentTree:
      def __init__(self, a):
          self.padding = float("inf")
          self.n = len(a)
          self.N = 1 << (self.n - 1).bit_length()
          self.seg_data = (
              [self.padding] * (self.N - 1) + a + [self.padding] * (self.N - self.n)
          )
          self.lazy = [None] * (2 * self.N - 1)
          for i in range(2 * self.N - 2, 0, -2):
              self.seg_data[(i - 1) >> 1] = min(self.seg_data[i], self.seg_data[i - 1])
  
      def __len__(self):
          return self.n
  
      def enum_idx(self, idx1, idx2):
          # idx1とidx2を部分的に含むインデックス(=red)、完全に含むインデックス(=blue)を
          # 降順に出力
          red = []
          red_set = set()
          blue = []
          while idx1 < idx2:
              if idx2 & 1 == 1:  # idx2が奇数
                  blue.append(idx2)
                  idx2 >>= 1
                  red.append(idx2)
                  red_set.add(idx2)
                  idx2 -= 1
              else:
                  idx2 = (idx2 - 1) >> 1
              if idx1 & 1 == 0:  # idx1が偶数
                  blue.append(idx1)
                  idx1 >>= 1
                  red.append(idx1 - 1)
                  red_set.add(idx1 - 1)
              else:
                  idx1 >>= 1
          if idx1 not in red_set:
              blue.append(idx1)
          while idx1:
              idx1 = (idx1 - 1) >> 1
              red.append(idx1)
          return red, blue
  
      def propagate(self, indices):
          # 遅延させていた値を伝搬させる
          # indicesは昇順
          for idx in indices:
              v = self.lazy[idx]
              if v is not None:
                  idx1, idx2 = 2 * idx + 1, 2 * idx + 2
                  self.lazy[idx1] = self.lazy[idx2] = v
                  self.seg_data[idx1] = self.seg_data[idx2] = v
                  self.lazy[idx] = None
  
      def update(self, i, j, x):
          # [i, j)の区間の値をxに変更する
          red, blue = self.enum_idx(self.N - 1 + i, self.N - 2 + j)
          self.propagate(red[::-1])
          for idx in blue:
              self.lazy[idx] = self.seg_data[idx] = x
  
          for idx in red:
              idx1, idx2 = 2 * idx + 1, 2 * idx + 2
              self.seg_data[idx] = min(self.seg_data[idx1], self.seg_data[idx2])
  
      def query(self, i, j):
          # [i, j)
          red, blue = self.enum_idx(self.N - 1 + i, self.N - 2 + j)
          self.propagate(red[::-1])
          result = self.padding
          for idx in blue:
              result = min(result, self.seg_data[idx])
          return result
  
      @property
      def data(self):
          return self.seg_data[self.N - 1 : self.N - 1 + self.n]
  
  
  N, Q = map(int, input().split())
  STX = [list(map(int, input().split())) for i in range(N)]
  STX.sort(key=lambda x: x[2], reverse=True)
  st = LazyPropSegmentTree([float("inf")] * Q)
  d = [int(input()) for i in range(Q)]
  
  for s, t, x in STX:
      il = bisect.bisect_left(d, s - x)
      ir = bisect.bisect_right(d, t - x - 1)
      if il == ir:
          continue
      st.update(il, ir, x)
  
  for i in range(Q):
      x = st.query(i, i + 1)
      if x < float("inf"):
          print(x)
      else:
          print(-1)
  
problem_description: Statement
  
  There is an infinitely long street that runs west to east, which we consider
  as a number line.
  
  There are N roadworks scheduled on this street. The i-th roadwork blocks the
  point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5.
  
  Q people are standing at coordinate 0. The i-th person will start the
  coordinate 0 at time D_i, continue to walk with speed 1 in the positive
  direction and stop walking when reaching a blocked point.
  
  Find the distance each of the Q people will walk.
samples: [{"input": "4 6\n    1 3 2\n    7 13 10\n    18 20 13\n    3 4 2\n    0\n    1\n    2\n    3\n    5\n    8", "output": "2\n    2\n    10\n    -1\n    13\n    -1\n    \n\nThe first person starts coordinate 0 at time 0 and stops walking at coordinate\n2 when reaching a point blocked by the first roadwork at time 2.\n\nThe second person starts coordinate 0 at time 1 and reaches coordinate 2 at\ntime 3. The first roadwork has ended, but the fourth roadwork has begun, so\nthis person also stops walking at coordinate 2.\n\nThe fourth and sixth persons encounter no roadworks while walking, so they\nwalk forever. The output for these cases is -1."}]