#include <bits/stdc++.h>
using namespace std;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= 1000000007;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
long long gcd(long long x, long long y) {
  while (y) {
    long long t = x % y;
    x = y;
    y = t;
  }
  return x;
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
int n, m, f[100010];
int fst[100010], nxt[400100], vv[400100], ee;
int mxd[100010], dep[100010], top[100010], siz[100010], son[100010], fa[100010],
    dfn[100010], lab[100010], tot;
struct node {
  int lsum, rsum, sum, l, r;
  node() {}
  node(int l, int r, int s, int _l, int _r)
      : lsum(l), rsum(r), sum(s), l(_l), r(_r) {}
} t[400100];
node U(node l, node r) {
  node x(0, 0, 0, l.l, r.r);
  x.sum = l.sum + r.sum;
  if (l.lsum == l.r - l.l + 1)
    x.lsum = l.lsum + r.lsum;
  else
    x.lsum = l.lsum;
  if (r.rsum == r.r - r.l + 1)
    x.rsum = r.rsum + l.rsum;
  else
    x.rsum = r.rsum;
  if (l.rsum && r.lsum) x.sum += f[l.rsum + r.lsum] - f[l.rsum] - f[r.lsum];
  return x;
}
struct Query {
  int u, v, z, id;
  bool operator<(const Query &a) const { return z < a.z; }
} q[100010], e[100010];
void init() {
  memset(fst, -1, sizeof fst);
  tot = ee = 0;
}
void add(int u, int v) {
  vv[ee] = v, nxt[ee] = fst[u], fst[u] = ee++;
  vv[ee] = u, nxt[ee] = fst[v], fst[v] = ee++;
}
void dfs1(int u) {
  siz[u] = 1, son[u] = 0;
  for (int i = fst[u]; ~i; i = nxt[i]) {
    int v = vv[i];
    if (v == fa[u]) continue;
    fa[v] = u;
    dep[v] = dep[u] + 1;
    dfs1(v);
    siz[u] += siz[v];
    if (siz[v] > siz[son[u]]) son[u] = v;
  }
}
void dfs2(int u, int tp) {
  dfn[u] = ++tot, lab[tot] = u, top[u] = tp;
  if (son[u]) dfs2(son[u], tp);
  for (int i = fst[u]; ~i; i = nxt[i]) {
    int v = vv[i];
    if (v == fa[u] || v == son[u]) continue;
    dfs2(v, v);
  }
}
void up(int ll, int rr, int rt) {
  t[rt].sum = t[(rt << 1)].sum + t[((rt << 1) | 1)].sum;
  if (t[(rt << 1)].lsum == ((ll + rr) / 2) - ll + 1)
    t[rt].lsum = t[(rt << 1)].lsum + t[((rt << 1) | 1)].lsum;
  else
    t[rt].lsum = t[(rt << 1)].lsum;
  if (t[((rt << 1) | 1)].rsum == rr - ((ll + rr) / 2))
    t[rt].rsum = t[((rt << 1) | 1)].rsum + t[(rt << 1)].rsum;
  else
    t[rt].rsum = t[((rt << 1) | 1)].rsum;
  if (t[(rt << 1)].rsum && t[((rt << 1) | 1)].lsum) {
    t[rt].sum += f[t[(rt << 1)].rsum + t[((rt << 1) | 1)].lsum] -
                 f[t[(rt << 1)].rsum] - f[t[((rt << 1) | 1)].lsum];
  }
}
void update(int ll, int rr, int rt, int x, int v) {
  t[rt].l = ll, t[rt].r = rr;
  if (ll == rr) {
    if (v)
      t[rt].sum = f[1], t[rt].lsum = t[rt].rsum = 1;
    else
      t[rt].sum = 0, t[rt].lsum = t[rt].rsum = 0;
    return;
  }
  if (x <= ((ll + rr) / 2))
    update(ll, ((ll + rr) / 2), (rt << 1), x, v);
  else
    update(((ll + rr) / 2) + 1, rr, ((rt << 1) | 1), x, v);
  up(ll, rr, rt);
}
node query(int l, int r, int ll, int rr, int rt) {
  if (l > r || l < ll || r > rr) cout << rt / 0 << endl;
  if (ll == l && rr == r) return node(t[rt].lsum, t[rt].rsum, t[rt].sum, l, r);
  if (r <= ((ll + rr) / 2))
    return query(l, r, ll, ((ll + rr) / 2), (rt << 1));
  else if (l > ((ll + rr) / 2))
    return query(l, r, ((ll + rr) / 2) + 1, rr, ((rt << 1) | 1));
  else {
    node a = query(l, ((ll + rr) / 2), ll, ((ll + rr) / 2), (rt << 1));
    node b =
        query(((ll + rr) / 2) + 1, r, ((ll + rr) / 2) + 1, rr, ((rt << 1) | 1));
    return U(a, b);
  }
}
int query(int u, int v) {
  node l(0, 0, 0, 0, 0x3f3f3f3f), r(0, 0, 0, 0, 0x3f3f3f3f);
  int f1 = top[u], f2 = top[v];
  while (f1 != f2) {
    if (dep[f1] > dep[f2]) {
      node tmp = query(dfn[f1], dfn[u], 1, n, 1);
      l = U(tmp, l);
      u = fa[f1];
      f1 = top[u];
    } else {
      node tmp = query(dfn[f2], dfn[v], 1, n, 1);
      r = U(tmp, r);
      v = fa[f2];
      f2 = top[v];
    }
  }
  if (dep[u] > dep[v]) {
    node tmp = query(dfn[v] + 1, dfn[u], 1, n, 1);
    l = U(tmp, l);
    node x = node(l.rsum, l.lsum, l.sum, l.l, l.r);
    return U(x, r).sum;
  } else if (dep[v] > dep[u]) {
    node tmp = query(dfn[u] + 1, dfn[v], 1, n, 1);
    r = U(tmp, r);
    node x = node(l.rsum, l.lsum, l.sum, l.l, l.r);
    return U(x, r).sum;
  } else {
    node x = node(l.rsum, l.lsum, l.sum, l.l, l.r);
    return U(x, r).sum;
  }
}
int ans[100010];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i < n; i++) scanf("%d", &f[i]);
  init();
  for (int i = 1; i < n; i++) {
    scanf("%d %d %d", &e[i].u, &e[i].v, &e[i].z);
    add(e[i].u, e[i].v);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", &q[i].u, &q[i].v, &q[i].z);
    q[i].id = i;
  }
  sort(e + 1, e + n);
  sort(q, q + m);
  dfs1(1);
  dfs2(1, 1);
  for (int i = 1; i < n; i++) {
    int u = e[i].u, v = e[i].v;
    if (dep[u] > dep[v])
      mxd[i] = u;
    else
      mxd[i] = v;
    update(1, n, 1, dfn[mxd[i]], 1);
  }
  for (int i = 0, j = 1; i < m; i++) {
    while (j < n && e[j].z < q[i].z) {
      update(1, n, 1, dfn[mxd[j]], 0);
      j++;
    }
    ans[q[i].id] = query(q[i].u, q[i].v);
  }
  for (int i = 0; i < m; i++) printf("%d\n", ans[i]);
  return 0;
}
