#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
const int maxl = 20;
int sz[maxn], f[maxn], par[maxn][maxl], h[maxn];
vector<int> adj[maxn], adw[maxn];
int chn[maxn];
int w[maxn];
struct node {
  long long p, s, tot, cnt;
  node() { cnt = p = s = tot = 0LL; }
  node(int first) {
    tot = 0LL;
    p = s = cnt = first;
  }
  inline bool ish() { return (cnt == p && p && s); }
  inline node operator*(node a) {
    node ans;
    ans.cnt = a.cnt + cnt;
    bool h = ish(), H = a.ish();
    ans.tot = a.tot + tot;
    if (!h && !H) {
      ans.tot += f[s + a.p];
      ans.p = p;
      ans.s = a.s;
    } else if (!h && H) {
      ans.p = p;
      ans.s = s + a.s;
    } else if (h && !H) {
      ans.p = p + a.p;
      ans.s = a.s;
    } else {
      ans.p = ans.s = p + a.p;
    }
    return ans;
  }
  inline long long score() {
    long long ans = tot + f[p];
    if (!ish()) ans += f[s];
    return ans;
  }
  inline node reverse() {
    node ans;
    ans.p = s;
    ans.s = p;
    ans.tot = tot;
    ans.cnt = cnt;
    return ans;
  }
};
struct seg {
  vector<node> s;
  int sz;
  seg() { sz = 0; }
  seg(int n) {
    while (s.size() < 4 * n) s.push_back(node());
    sz = n;
  }
  inline void add(int p, int id, int l, int r) {
    if (r - l < 2) {
      s[id] = node(1);
      return;
    }
    int mid = (l + r) / 2;
    if (p < mid)
      add(p, ((id) << 1), l, mid);
    else
      add(p, (((id) << 1) + 1), mid, r);
    s[id] = s[((id) << 1)] * s[(((id) << 1) + 1)];
  }
  inline node get(int first, int second, int id, int l, int r) {
    if (first <= l && r <= second) return s[id];
    int mid = (l + r) / 2;
    if (second <= mid)
      return get(first, second, ((id) << 1), l, mid);
    else if (mid <= first)
      return get(first, second, (((id) << 1) + 1), mid, r);
    return get(first, second, ((id) << 1), l, mid) *
           get(first, second, (((id) << 1) + 1), mid, r);
  }
  inline void ADD(int p) { add(p, 1, 0, sz); }
  inline node score(int first, int second) {
    return get(first, second, 1, 0, sz);
  }
};
struct query {
  int ind, mnh, mxh, l;
  query() {}
  query(int a, int b, int c, int d) {
    ind = a;
    mnh = b;
    mxh = c;
    l = d;
  }
};
inline bool qcmp(const query &a, const query &q) { return a.l < q.l; }
inline bool cmp(const pair<int, int> &p, const pair<int, int> &q) {
  if (p.second - q.second) return p.second > q.second;
  return p.first < q.first;
}
struct chain {
  int X, first, second;
  seg s;
  unordered_map<int, node> MP;
  chain() {}
  chain(int a, int b) : X(a), second(b) {}
  chain(int a, int b, int c) : X(a), first(b), second(c) {}
  vector<pair<int, int> > vpn;
  vector<query> QQ;
  inline void proc(int i) {
    int v = second;
    while (v != X) {
      if (par[v][0] == X) first = v;
      vpn.push_back({h[v], w[v]});
      chn[v] = i;
      v = par[v][0];
    }
    sort(vpn.begin(), vpn.end());
  }
  inline void solve() {
    sort(QQ.begin(), QQ.end(), qcmp);
    s = seg(vpn.size());
    vector<pair<int, int> > vs = vpn;
    sort(vs.begin(), vs.end(), cmp);
    reverse(QQ.begin(), QQ.end());
    int po = 0;
    for (auto &(q) : (QQ)) {
      while (po < vs.size() && vs[po].second >= q.l) {
        int i = lower_bound(vpn.begin(), vpn.end(),
                            pair<int, int>(vs[po].first, -1)) -
                vpn.begin();
        s.ADD(i);
        po++;
      }
      int l = lower_bound(vpn.begin(), vpn.end(), pair<int, int>(q.mnh, -1)) -
              vpn.begin();
      int r = upper_bound(vpn.begin(), vpn.end(), pair<int, int>(q.mxh, 1e9)) -
              vpn.begin();
      MP[q.ind] = s.score(l, r);
    }
  }
};
vector<chain> HLD;
inline int dfs(int v = 0, int p = -1) {
  if (p + 1) h[v] = h[p] + 1;
  par[v][0] = p;
  for (int(i) = (1); (i) < (maxl); ++(i))
    if (par[v][i - 1] + 1) par[v][i] = par[par[v][i - 1]][i - 1];
  sz[v] = 1;
  for (int(i) = (0); (i) < (adj[v].size()); ++(i)) {
    int u = adj[v][i];
    if (u - p) {
      w[u] = adw[v][i];
      sz[v] += dfs(u, v);
    }
  }
  return sz[v];
}
inline void prepHLD(int v = 0, bool h = 0, int f = -1) {
  if (f == -1) {
    if (par[v][0] != -1)
      f = par[v][0];
    else
      f = v;
  }
  bool hh = 0, ch = 0, is = 0;
  for (auto &(u) : (adj[v])) {
    if (u - par[v][0] && sz[u] * 2 >= sz[v]) hh = 1;
    if (u - par[v][0]) ch = 1;
  }
  if (par[v][0] != -1) {
    if (h && !hh && !ch) HLD.push_back(chain(f, v));
    if (!h && !ch) HLD.push_back(chain(par[v][0], v));
  }
  for (auto &(u) : (adj[v]))
    if (u - par[v][0]) {
      if (sz[u] * 2 < sz[v]) {
        if (!is && !hh)
          prepHLD(u, 1, f);
        else
          prepHLD(u);
      } else
        prepHLD(u, 1, f);
      is = 1;
    }
}
inline int lca(int v, int u) {
  if (h[u] > h[v]) swap(v, u);
  for (int(i) = (maxl - 1); (i) > (-1); --(i))
    if (par[v][i] + 1 && h[par[v][i]] >= h[u]) v = par[v][i];
  if (v == u) return v;
  for (int(i) = (maxl - 1); (i) > (-1); --(i))
    if (par[v][i] - par[u][i]) v = par[v][i], u = par[u][i];
  return par[v][0];
}
inline vector<int> dec(int v, int H) {
  vector<int> ans;
  while (v + 1 && h[v] > H) {
    ans.push_back(chn[v]);
    v = HLD[chn[v]].X;
  }
  return ans;
}
inline vector<int> decompose(int v, int u) {
  int first = lca(v, u);
  int H = h[first];
  vector<int> ans = dec(v, H);
  vector<int> V = dec(u, H);
  reverse(V.begin(), V.end());
  for (auto &(w) : (V)) ans.push_back(w);
  return ans;
}
stringstream ss;
inline void prepQ(int i, int v, int w, int l) {
  while (v + 1 && h[v] > h[w]) {
    int j = chn[v];
    int mnh = h[w] + 1;
    int mxh = h[v];
    HLD[j].QQ.push_back(query(i, mnh, mxh, l));
    v = HLD[chn[v]].X;
  }
}
inline void prepq(int i, int v, int u, int l) {
  ss << v << ' ' << u << ' ' << l << '\n';
  int w = lca(v, u);
  prepQ(i, v, w, l);
  prepQ(i, u, w, l);
}
int IND;
inline long long ANS() {
  int v, u, l;
  ss >> v >> u >> l;
  int w = lca(v, u);
  vector<int> V = decompose(v, w);
  vector<int> U = decompose(w, u);
  node N(0);
  for (auto &(c) : (V)) N = N * HLD[c].MP[IND].reverse();
  for (auto &(c) : (U)) {
    N = N * HLD[c].MP[IND];
  }
  IND++;
  return N.score();
}
int n, q;
int main() {
  memset(par, -1, sizeof(par));
  ios_base::sync_with_stdio(false);
  cin >> n >> q;
  for (int(i) = (1); (i) < (n); ++(i)) cin >> f[i];
  int v, u, w;
  for (int(i) = (1); (i) < (n); ++(i)) {
    cin >> v >> u >> w;
    --v, --u;
    adj[v].push_back(u);
    adj[u].push_back(v);
    adw[v].push_back(w);
    adw[u].push_back(w);
  }
  dfs();
  prepHLD();
  for (int(i) = (0); (i) < (HLD.size()); ++(i)) HLD[i].proc(i);
  for (int(i) = (0); (i) < (q); ++(i)) {
    cin >> v >> u >> w;
    --v, --u;
    prepq(i, v, u, w);
  }
  for (int(i) = (0); (i) < (HLD.size()); ++(i)) HLD[i].solve();
  for (int(i) = (0); (i) < (q); ++(i)) cout << ANS() << '\n';
}
