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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Comparator;
import java.util.TreeSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author lewin
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ERoadwork solver = new ERoadwork();
        solver.solve(1, in, out);
        out.close();
    }

    static class ERoadwork {
        public static int INF = 1 << 29;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt(), q = in.nextInt();
            ERoadwork.Event[] es = new ERoadwork.Event[2 * n];
            int[] s = new int[n], t = new int[n], x = new int[n];
            for (int i = 0; i < n; i++) {
                s[i] = 2 * in.nextInt();
                t[i] = 2 * in.nextInt();
                x[i] = 2 * in.nextInt();
                es[2 * i] = new ERoadwork.Event(s[i] - x[i] - 1, i, +1);
                es[2 * i + 1] = new ERoadwork.Event(t[i] - x[i] - 1, i, -1);
            }
            Arrays.sort(es, Comparator.comparingInt(y -> y.time));
            ERoadwork.Query[] qs = new ERoadwork.Query[q];
            for (int i = 0; i < q; i++) {
                qs[i] = new ERoadwork.Query(2 * in.nextInt(), i);
            }
            Arrays.sort(qs, Comparator.comparingInt(y -> y.time));
            int[] ans = new int[q];
            int ptr = 0;
            TreeSet<Integer> ts = new TreeSet<>(Comparator.comparingLong(y -> 1L * x[y] * n + y));
            for (int i = 0; i < q; i++) {
                while (ptr < es.length && es[ptr].time < qs[i].time) {
                    if (es[ptr].type == +1) ts.add(es[ptr].idx);
                    else ts.remove(es[ptr].idx);
                    ptr++;
                }
                if (ts.size() == 0) ans[i] = INF;
                else ans[i] = x[ts.first()];
            }

            for (int i = 0; i < q; i++) {
                if (ans[i] == INF) ans[i] = -1;
                else ans[i] /= 2;
            }

            out.println(ans);

        }

        static class Event {
            public int time;
            public int idx;
            public int type;

            public Event(int time, int idx, int type) {
                this.time = time;
                this.idx = idx;
                this.type = type;
            }

        }

        static class Query {
            public int time;
            public int idx;

            public Query(int time, int idx) {
                this.time = time;
                this.idx = idx;
            }

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(int[] array) {
            for (int i = 0; i < array.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(array[i]);
            }
        }

        public void println(int[] array) {
            print(array);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1 << 16];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (this.numChars == -1) {
                throw new InputMismatchException();
            } else {
                if (this.curChar >= this.numChars) {
                    this.curChar = 0;

                    try {
                        this.numChars = this.stream.read(this.buf);
                    } catch (IOException var2) {
                        throw new InputMismatchException();
                    }

                    if (this.numChars <= 0) {
                        return -1;
                    }
                }

                return this.buf[this.curChar++];
            }
        }

        public int nextInt() {
            int c;
            for (c = this.read(); isSpaceChar(c); c = this.read()) {
                ;
            }

            byte sgn = 1;
            if (c == 45) {
                sgn = -1;
                c = this.read();
            }

            int res = 0;

            while (c >= 48 && c <= 57) {
                res *= 10;
                res += c - 48;
                c = this.read();
                if (isSpaceChar(c)) {
                    return res * sgn;
                }
            }

            throw new InputMismatchException();
        }

        public static boolean isSpaceChar(int c) {
            return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;
        }

    }
}

