using System;
using System.Linq;
using System.Collections.Generic;

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC128.E();
        }



        class ABC128
        {
            public static void A()
            {
                var A = Read.Int();
                var P = Read.Int();
                Console.WriteLine((A * 3 + P) / 2);
            }
            public static void B()
            {
                var N = Read.Int();
                var dict = new Dictionary<string, List<Tuple<int, int>>>();
                for (int n = 1; n <= N; ++n)
                {
                    var s = Read.Str();
                    var p = Read.Int();
                    if (!dict.ContainsKey(s)) { dict.Add(s, new List<Tuple<int, int>>()); }
                    dict[s].Add(new Tuple<int, int>(p, n));
                }
                foreach (var kvp in dict.OrderBy(x => x.Key))
                {
                    var ps = kvp.Value.OrderBy(x => -x.Item1).ToArray();
                    foreach (var p in ps)
                    {
                        Console.WriteLine(p.Item2);
                    }
                }
            }
            public static void C()
            {
                var N = Read.Int();
                var M = Read.Int();
                var S = new HashSet<int>[M];
                for (int i = 0; i < M; ++i)
                {
                    S[i] = new HashSet<int>();
                    var s = Read.IntN();
                    foreach (var ss in s.Skip(1))
                    {
                        S[i].Add(ss - 1);
                    }
                }
                var P = Read.IntN();
                int count = 0;
                for (int i = 0; i < (1 << N); ++i)
                {
                    bool ok = true;
                    for (int m = 0; m < M; ++m)
                    {
                        var on = 0;
                        foreach (var n in S[m])
                        {
                            if (((1 << n) & i) > 0) { on++; }
                        }
                        if (on % 2 != P[m]) { ok = false; break; }
                    }
                    if (ok) { count++; }
                }
                Console.WriteLine(count);
            }
            public static void D()
            {
                var N = Read.Int();
                var K = Read.Int();
                var V = Read.LongN();
                long max = 0;
                for (int left = 0; left <= N; ++left)
                {
                    for (int right = 0; right <= N - left; ++right)
                    {
                        if (left + right > K) { break; }
                        List<long> list = new List<long>();
                        for (int i = 0; i < left; ++i) { list.Add(V[i]); }
                        for (int i = 0; i < right; ++i) { list.Add(V[N - 1 - i]); }
                        list = list.OrderBy(x => x).ToList();
                        long sum = 0;
                        int drop = K - left - right;
                        for (int i = 0; i < list.Count; ++i)
                        {
                            sum += i < drop ? Math.Max(0, list[i]) : list[i];
                        }
                        max = Math.Max(max, sum);
                    }
                }
                Console.WriteLine(max);
            }
            public static void E()
            {
                var N = Read.Int();
                var Q = Read.Int();
                var STX = new Tuple<long, long, long>[N];
                for (int i = 0; i < N; ++i)
                {
                    var v = Read.LongN();
                    STX[i] = new Tuple<long, long, long>(v[0], v[1], v[2]);
                }
                var D = Enumerable.Range(0, Q).Select(i => Read.Long()).ToArray();
                var D_Dict = new Dictionary<long, int>();
                var D_Set = new Util.Set<long>();
                for(int i = 0; i < Q; ++i)
                {
                    D_Dict.Add(D[i], i);
                    D_Set.Insert(D[i]);
                }
                D_Set.Insert(-1);
                D_Set.Insert(1000000001);
                long[] goal = Enumerable.Range(0, Q).Select(i => -1L).ToArray();
                foreach(var stx in STX.OrderBy(x => x.Item3))
                {
                    var DS = stx.Item1 - stx.Item3;
                    var DT = stx.Item2 - stx.Item3;
                    var idxS = D_Set.LowerBound(DS);
                    var idxT = D_Set.LowerBound(DT);
                    var qs = new HashSet<long>();
                    for(int i = idxS; i < idxT; ++i)
                    {
                        qs.Add(D_Set.ElementAt(i));
                    }
                    foreach(var q in qs)
                    {
                        if (D_Dict.ContainsKey(q))
                        {
                            D_Set.Remove(q);
                            goal[D_Dict[q]] = stx.Item3;
                        }
                    }
                }
                var sb = new System.Text.StringBuilder();
                foreach(var g in goal)
                {
                    sb.AppendLine(g.ToString());
                }
                Console.Write(sb.ToString());
            }
        }




        class Util
        {
            public static long[] ASum(long[] array)
            {
                var res = new long[array.Length + 1];
                for (int i = 0; i < array.Length; ++i)
                {
                    res[i + 1] = res[i] + array[i];
                }
                return res;
            }
            public class BST<T> where T : IComparable
            {
                public class Node
                {
                    public T V;
                    public Node L, R;
                    public int Count;
                    public Node(T v) { V = v; Count = 1; }
                }
                static Random _rnd = new Random();
                public static int Count(Node t) { return t == null ? 0 : t.Count; }
                static Node Update(Node t) { t.Count = Count(t.L) + Count(t.R) + 1; return t; }
                public static Node Merge(Node l, Node r)
                {
                    if (l == null || r == null) return l == null ? r : l;
                    if ((double)Count(l) / (double)(Count(l) + Count(r)) > _rnd.NextDouble())
                    { l.R = Merge(l.R, r); return Update(l); }
                    else { r.L = Merge(l, r.L); return Update(r); }
                }
                public static Tuple<Node, Node> Split(Node t, int k)
                {
                    if (t == null) return new Tuple<Node, Node>(null, null);
                    if (k <= Count(t.L))
                    {
                        var s = Split(t.L, k);
                        t.L = s.Item2;
                        return new Tuple<Node, Node>(s.Item1, Update(t));
                    }
                    else
                    {
                        var s = Split(t.R, k - Count(t.L) - 1);
                        t.R = s.Item1;
                        return new Tuple<Node, Node>(Update(t), s.Item2);
                    }
                }
                public static Node Remove(Node t, T v)
                {
                    if (Find(t, v) == null) return t;
                    return RemoveAt(t, LowerBound(t, v));
                }
                public static Node RemoveAt(Node t, int k)
                {
                    var s = Split(t, k);
                    var s2 = Split(s.Item2, 1);
                    return Merge(s.Item1, s2.Item2);
                }
                public static bool Contains(Node t, T v) { return Find(t, v) != null; }
                public static Node Find(Node t, T v)
                {
                    while (t != null)
                    {
                        var cmp = t.V.CompareTo(v);
                        if (cmp > 0) t = t.L;
                        else if (cmp < 0) t = t.R;
                        else break;
                    }
                    return t;
                }

                public static Node FindByIndex(Node t, int idx)
                {
                    if (t == null) return null;
                    var currentIdx = Count(t) - Count(t.R) - 1;
                    while (t != null)
                    {
                        if (currentIdx == idx) return t;
                        if (currentIdx > idx)
                        { t = t.L; currentIdx -= (Count(t == null ? null : t.R) + 1); }
                        else { t = t.R; currentIdx += (Count(t == null ? null : t.L) + 1); }
                    }
                    return null;
                }
                public static int UpperBound(Node t, T v)
                {
                    var torg = t;
                    if (t == null) return -1;

                    var ret = Int32.MaxValue;
                    var idx = Count(t) - Count(t.R) - 1;
                    while (t != null)
                    {
                        var cmp = t.V.CompareTo(v);

                        if (cmp > 0)
                        {
                            ret = Math.Min(ret, idx);
                            t = t.L;
                            idx -= (Count(t == null ? null : t.R) + 1);
                        }
                        else if (cmp <= 0)
                        {
                            t = t.R;
                            idx += (Count(t == null ? null : t.L) + 1);
                        }
                    }
                    return ret == Int32.MaxValue ? Count(torg) : ret;
                }
                public static int LowerBound(Node t, T v)
                {
                    var torg = t;
                    if (t == null) return -1;

                    var idx = Count(t) - Count(t.R) - 1;
                    var ret = Int32.MaxValue;
                    while (t != null)
                    {
                        var cmp = t.V.CompareTo(v);
                        if (cmp >= 0)
                        {
                            if (cmp == 0) ret = Math.Min(ret, idx);
                            t = t.L;
                            if (t == null) ret = Math.Min(ret, idx);
                            idx -= t == null ? 0 : (Count(t.R) + 1);
                        }
                        else if (cmp < 0)
                        {
                            t = t.R;
                            idx += (Count(t == null ? null : t.L) + 1);
                            if (t == null) return idx;
                        }
                    }
                    return ret == Int32.MaxValue ? Count(torg) : ret;
                }
                public static Node Insert(Node t, T v)
                {
                    var ub = LowerBound(t, v);
                    return InsertByIdx(t, ub, v);
                }
                static Node InsertByIdx(Node t, int k, T v)
                {
                    var s = Split(t, k);
                    return Merge(Merge(s.Item1, new Node(v)), s.Item2);
                }
                public static IEnumerable<T> Enumerate(Node t)
                {
                    var ret = new List<T>();
                    Enumerate(t, ret);
                    return ret;
                }
                static void Enumerate(Node t, List<T> ret)
                {
                    if (t == null) return;
                    Enumerate(t.L, ret);
                    ret.Add(t.V);
                    Enumerate(t.R, ret);
                }
            }
            public class Set<T> where T : IComparable
            {
                protected BST<T>.Node _root;
                public T this[int idx] { get { return ElementAt(idx); } }
                public int Count() { return BST<T>.Count(_root); }
                public virtual void Insert(T v)
                {
                    if (_root == null) _root = new BST<T>.Node(v);
                    else
                    {
                        if (BST<T>.Find(_root, v) != null) return;
                        _root = BST<T>.Insert(_root, v);
                    }
                }
                public void Clear() { _root = null; }
                public void Remove(T v) { _root = BST<T>.Remove(_root, v); }
                public bool Contains(T v) { return BST<T>.Contains(_root, v); }
                public T ElementAt(int k)
                {
                    var node = BST<T>.FindByIndex(_root, k);
                    if (node == null) throw new IndexOutOfRangeException();
                    return node.V;
                }
                public int Count(T v) { return BST<T>.UpperBound(_root, v) - BST<T>.LowerBound(_root, v); }
                public int LowerBound(T v) { return BST<T>.LowerBound(_root, v); }
                public int UpperBound(T v) { return BST<T>.UpperBound(_root, v); }
                public Tuple<int, int> EqualRange(T v)
                {
                    if (!Contains(v)) return new Tuple<int, int>(-1, -1);
                    return new Tuple<int, int>(BST<T>.LowerBound(_root, v), BST<T>.UpperBound(_root, v) - 1);
                }
                public List<T> ToList() { return new List<T>(BST<T>.Enumerate(_root)); }
            }
        }

        static class Read
        {
            static Queue<string> queue = new Queue<string>();
            static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
            public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
            public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
            public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
            public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
            public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
            public static string[] StrN() { return Console.ReadLine().Split(' '); }
            public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
            public static long[,] LongMatrix(int r, int c)
            {
                var mat = new long[r, c];
                for (int i = 0; i < r; ++i)
                {
                    var x = Read.LongN();
                    for (int j = 0; j < c; ++j)
                    {
                        mat[i, j] = x[j];
                    }
                }
                return mat;
            }
            public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M)
            {
                Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new HashSet<int>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1]);
                    dict[ab[1]].Add(ab[0]);
                }
                return dict;
            }
            public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M)
            {
                Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new Dictionary<int, long>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1], ab[2]);
                    dict[ab[1]].Add(ab[0], ab[2]);
                }
                return dict;
            }
        }
    }
}


Measured memory_bytes: 68712