#include <bits/stdc++.h>
using namespace std;
const int maxn = 100050, maxq = 100050, maxns = 1 << 18;
struct Edge {
  int x, y, w;
  bool operator<(const Edge &rhs) const { return w > rhs.w; }
  void scan();
};
struct Query {
  int id, x, y, l;
  bool operator<(const Query &rhs) const { return l > rhs.l; }
  void scan(int i) { id = i, scanf("%d%d%d", &x, &y, &l); }
};
struct Node {
  int sum, lo, ro;
  bool z;
  Node(int sum = 0, int lo = 0, int ro = 0, bool z = 0)
      : sum(sum), lo(lo), ro(ro), z(z) {}
};
int n, q, ans[maxn];
int f[maxn];
Edge ed[maxn];
int es = 0, he[maxn], ne[maxn * 2], to[maxn * 2];
Query que[maxq];
int fa[maxn], dep[maxn], siz[maxn], son[maxn], top[maxn];
int tim = 0, pos[2][maxn];
Node tr[2][maxns];
void ins(int x, int y) { ne[++es] = he[x], he[x] = es, to[es] = y; }
void Edge::scan() {
  scanf("%d%d%d", &x, &y, &w);
  ins(x, y), ins(y, x);
}
void dfs(int x) {
  int i, y;
  siz[x] = 1;
  for (i = he[x]; i; i = ne[i])
    if ((y = to[i]) != fa[x]) {
      fa[y] = x;
      dep[y] = dep[x] + 1;
      dfs(y);
      siz[x] += siz[y];
      if (siz[y] > siz[son[x]]) son[x] = y;
    }
}
void dfs2(int x) {
  int i, y;
  pos[0][x] = ++tim;
  pos[1][x] = n - tim + 1;
  if (son[x]) top[son[x]] = top[x], dfs2(son[x]);
  for (i = he[x]; i; i = ne[i])
    if ((y = to[i]) != fa[x] && y != son[x]) top[y] = y, dfs2(y);
}
Node operator+(Node lx, Node rx) {
  int t = lx.ro + rx.lo, sum = lx.sum + rx.sum - f[lx.ro] - f[rx.lo] + f[t];
  if (lx.z && rx.z) return Node(sum, t, t, 1);
  if (lx.z) return Node(sum, t, rx.ro, 0);
  if (rx.z) return Node(sum, lx.lo, t, 0);
  return Node(sum, lx.lo, rx.ro, 0);
}
void modify(int c, int x, int ll, int rr, int p, int k) {
  if (ll == rr) {
    tr[c][x] = Node(f[1], 1, 1, 1);
    return;
  }
  int mid = (ll + rr) >> 1;
  if (p <= mid)
    modify(c, (x << 1), ll, mid, p, k);
  else
    modify(c, ((x << 1) | 1), mid + 1, rr, p, k);
  tr[c][x] = tr[c][(x << 1)] + tr[c][((x << 1) | 1)];
}
Node query(int c, int x, int ll, int rr, int li, int ri) {
  if (li <= ll && rr <= ri) return tr[c][x];
  int mid = (ll + rr) >> 1;
  Node s = Node(0, 0, 0, 1);
  if (li <= mid) s = s + query(c, (x << 1), ll, mid, li, ri);
  if (ri > mid) s = s + query(c, ((x << 1) | 1), mid + 1, rr, li, ri);
  return s;
}
void add(Edge e0) {
  int x = (dep[e0.x] > dep[e0.y] ? e0.x : e0.y);
  modify(0, 1, 1, n, pos[0][x], 1);
  modify(1, 1, 1, n, pos[1][x], 1);
}
int ask(int x, int y) {
  Node sx = Node(0, 0, 0, 1), sy = Node(0, 0, 0, 1);
  while (top[x] != top[y]) {
    if (dep[top[x]] > dep[top[y]])
      sx = sx + query(1, 1, 1, n, pos[1][x], pos[1][top[x]]), x = fa[top[x]];
    else
      sy = query(0, 1, 1, n, pos[0][top[y]], pos[0][y]) + sy, y = fa[top[y]];
  }
  if (dep[x] > dep[y])
    sx = sx + query(1, 1, 1, n, pos[1][x], pos[1][y] - 1);
  else if (dep[x] < dep[y])
    sy = query(0, 1, 1, n, pos[0][x] + 1, pos[0][y]) + sy;
  return (sx + sy).sum;
}
int main() {
  int i, j;
  scanf("%d%d", &n, &q);
  for (i = 1; i < n; i++) scanf("%d", &f[i]);
  for (i = 1; i < n; i++) ed[i].scan();
  dfs(1);
  dfs2(1);
  for (i = 0; i < q; i++) que[i].scan(i);
  sort(ed + 1, ed + n);
  sort(que, que + q);
  for (i = 0, j = 1; i < q; i++) {
    while (j < n && ed[j].w >= que[i].l) add(ed[j++]);
    ans[que[i].id] = ask(que[i].x, que[i].y);
  }
  for (i = 0; i < q; i++) printf("%d\n", ans[i]);
  return 0;
}
