#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 77, L = 17;
int n, q, tim = 1, Sz[N], St[N], En[N], F[N], Ev[N], Eu[N], Ew[N], Perm[N],
          Hv[N], d[N], Top[N], Par[N][L];
int Qv[N], Qu[N], Qw[N], A[N];
vector<int> a[N], V[N];
inline int GetPar(int v, int k) {
  for (int i = 0; i < L; ++i)
    if (k & (1 << i)) v = Par[v][i];
  return v;
}
inline int GetLca(int v, int u) {
  if (d[v] < d[u]) swap(v, u);
  v = GetPar(v, d[v] - d[u]);
  if (v == u) return v;
  for (int i = L - 1; i >= 0; --i)
    if (Par[v][i] != Par[u][i]) v = Par[v][i], u = Par[u][i];
  return Par[v][0];
}
struct Node {
  int sz = 0;
  int A = 0, le = 0, ri = 0;
  inline Node operator+(const Node& X) {
    Node T;
    T.sz = sz + X.sz;
    T.A = A + X.A;
    T.le = (le + (sz == le ? X.le : 0));
    T.ri = (X.ri + (X.sz == X.ri ? ri : 0));
    T.A += -F[X.le] - F[ri] + F[X.le + ri];
    return T;
  }
  inline void Print() {
    cout << sz << ' ' << le << ' ' << ri << ' ' << A << "\n\n\n";
  }
};
Node T[N << 2], EMP;
void Build(int l = 1, int r = n + 1, int id = 1) {
  T[id].sz = r - l;
  if (r - l < 2) return;
  int mid = ((l + r) >> 1);
  Build(l, mid, id << 1);
  Build(mid, r, id << 1 ^ 1);
}
void Change(int x, int l = 1, int r = n + 1, int id = 1) {
  if (r - l < 2) {
    T[id].le = T[id].ri = 1;
    T[id].A = F[1];
    return;
  }
  int mid = ((l + r) >> 1);
  if (x < mid)
    Change(x, l, mid, id << 1);
  else
    Change(x, mid, r, id << 1 ^ 1);
  T[id] = T[id << 1] + T[id << 1 ^ 1];
}
Node Get(int ql, int qr, int l = 1, int r = n + 1, int id = 1) {
  if (ql <= l && r <= qr) return T[id];
  if (qr <= l || r <= ql) return EMP;
  int mid = ((l + r) >> 1);
  return Get(ql, qr, l, mid, id << 1) + Get(ql, qr, mid, r, id << 1 ^ 1);
}
void dfsPre(int v, int prev = -1) {
  for (int i = 1; i < L; ++i) Par[v][i] = Par[Par[v][i - 1]][i - 1];
  Sz[v] = 1;
  for (int x : a[v]) {
    int u = Ev[x] ^ v ^ Eu[x];
    if (u == prev) continue;
    d[u] = d[v] + 1;
    Par[u][0] = v;
    dfsPre(u, v);
    Sz[v] += Sz[u];
    if (Hv[v] == 0 || Sz[Hv[v]] < Sz[u]) Hv[v] = u;
  }
}
void dfs(int v, int prev = -1) {
  St[v] = tim++;
  if (Hv[v] != 0) Top[Hv[v]] = Top[v], dfs(Hv[v], v);
  for (int x : a[v]) {
    int u = Ev[x] ^ v ^ Eu[x];
    if (u == prev || u == Hv[v]) continue;
    Top[u] = u;
    dfs(u, v);
  }
  En[v] = tim;
}
inline Node GetUp(int v, int dt) {
  Node X;
  while (d[v] >= dt) {
    int t = Top[v];
    if (d[t] >= dt) {
      X = Get(St[t], St[v] + 1) + X;
      v = Par[t][0];
    } else {
      t = GetPar(v, d[v] - dt);
      X = Get(St[t], St[v] + 1) + X;
      v = Par[t][0];
    }
  }
  return X;
}
inline int GetPath(int v, int u) {
  int Lca = GetLca(v, u);
  Node SS = GetUp(v, d[Lca] + 1);
  swap(SS.le, SS.ri);
  SS = (SS + GetUp(u, d[Lca] + 1));
  return SS.A;
}
bool CMP(int x, int y) { return Ew[x] < Ew[y]; }
int main() {
  d[1] = Top[1] = 1;
  scanf("%d %d", &n, &q);
  for (int i = 1; i < n; ++i) scanf("%d", F + i), Perm[i] = i;
  for (int i = 1; i < n; ++i) {
    scanf("%d %d %d", Ev + i, Eu + i, Ew + i);
    a[Ev[i]].push_back(i);
    a[Eu[i]].push_back(i);
  }
  Build();
  dfsPre(1);
  dfs(1);
  sort(Perm + 1, Perm + n, CMP);
  for (int i = 1; i <= q; ++i) {
    scanf("%d %d %d", Qv + i, Qu + i, Qw + i);
    int le = 0, ri = n;
    while (ri - le > 1) {
      int mid = ((le + ri) >> 1);
      if (Ew[Perm[mid]] >= Qw[i])
        ri = mid;
      else
        le = mid;
    }
    if (ri == n) {
      A[i] = 0;
      continue;
    }
    V[ri].push_back(i);
  }
  for (int v, u, i = n - 1; i > 0; --i) {
    int id = Perm[i];
    v = Ev[id];
    u = Eu[id];
    if (d[v] < d[u]) swap(v, u);
    Change(St[v]);
    for (int x : V[i]) A[x] = GetPath(Qv[x], Qu[x]);
  }
  for (int i = 1; i <= q; ++i) printf("%d\n", A[i]);
  return 0;
}
