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.

Constraints

* All values in input are integers.
* 1 \leq N, Q \leq 2 \times 10^5
* 0 \leq S_i < T_i \leq 10^9
* 1 \leq X_i \leq 10^9
* 0 \leq D_1 < D_2 < ... < D_Q \leq 10^9
* If i \neq j and X_i = X_j, the intervals [S_i, T_i) and [S_j, T_j) do not overlap.

Input

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


Output

Print Q lines. The i-th line should contain the distance the i-th person will walk or -1 if that person walks forever.

Example

Input

4 6
1 3 2
7 13 10
18 20 13
3 4 2
0
1
2
3
5
8


Output

2
2
10
-1
13
-1
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeSet;
public class Main {
  public static void main(String[] args) {
    Main m = new Main();
    m.run();
  }
  private void run() {
    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
      String[] p = br.readLine().split("\\s+");
      int n = Integer.parseInt(p[0]);
      int q = Integer.parseInt(p[1]);
      Roadwork[] r = new Roadwork[2*n];
      for (int i=0;i<2*n;i+=2) {
        p = br.readLine().split("\\s+");
        int s = Integer.parseInt(p[0]);
        int t = Integer.parseInt(p[1]);
        int x = Integer.parseInt(p[2]);
        r[i] = new Roadwork(s-x,1,x,i/2);
        r[i+1] = new Roadwork(t-x,-1,x,i/2);
      }
      Arrays.sort(r,Comparator.comparingInt(w -> w.t));
      int idx = -1;
      TreeSet<Roadwork> undergo = new TreeSet<>(Comparator.comparingInt(w -> w.x));
      StringBuilder sb = new StringBuilder();
      for (int k=0;k<q;k++) {
        int d = Integer.parseInt(br.readLine());
        while (idx < 2*n-1 && r[idx+1].t <= d) {
          idx++;
          if (r[idx].f > 0) undergo.add(new Roadwork(0,0,r[idx].x,r[idx].i));
          if (r[idx].f < 0) undergo.remove(new Roadwork(0,0,r[idx].x,r[idx].i));
        }
        if (undergo.isEmpty()) {
          sb.append(-1).append("\n");
        } else {
          sb.append(undergo.first().x).append("\n");
        }
      }
      System.out.print(sb);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  private class Roadwork {
    private int t,f,x,i;
    Roadwork(int t,int f,int x,int i) {
      this.t = t;
      this.f = f;
      this.x = x;
      this.i = i;
    }
    @Override
    public int hashCode() {
      int prime = 31;
      int result = 1;
      result = prime*result+t;
      result = prime*result+f;
      result = prime*result+x;
      result = prime*result+i;
      return result;
    }
    @Override
    public boolean equals(Object obj) {
      if (this == obj) return true;
      if (obj == null) return false;
      if (getClass() != obj.getClass()) return false;
      Roadwork other = (Roadwork)obj;
      return t == other.t && f == other.f && x == other.x && i == other.i;
    }
  }
}