#include <bits/stdc++.h>
using namespace std;
int ar[110000], dad[110000], D[110000], B[110000], res[110000];
int N, M, child_size[110000], cnt, prnt[25][110000];
vector<pair<int, int> > v[110000];
struct R {
  int a, b, c, where;
  R(int x = 0, int y = 0, int z = 0, int t = 0) {
    a = x;
    b = y;
    c = z;
    where = t;
  }
  friend bool operator<(const R &a, const R &b) { return a.c > b.c; }
};
vector<R> roads, Q;
struct node {
  int left, right, sum, size;
  node(int a = 0, int b = 0, int c = 0, int d = 0) {
    left = a;
    right = b;
    sum = c;
    size = d;
  }
  friend node operator+(const node &a, const node &b) {
    node c;
    c.left = a.left;
    c.right = b.right;
    c.size = a.size + b.size;
    c.sum = a.sum + b.sum;
    if (a.left == a.size) c.left = a.size + b.left;
    if (b.right == b.size) c.right = b.size + a.right;
    if (a.left != a.size && b.right != b.size) c.sum += ar[a.right + b.left];
    return c;
  }
};
node seg[110000 * 5];
node bir;
int find(int x) {
  if (dad[x] == x) return x;
  return dad[x] = find(dad[x]);
}
int calc_size(int x, int parent, int depth) {
  child_size[x] = 1;
  D[x] = depth;
  prnt[0][x] = parent;
  for (int i = 1; i <= 19; i++) prnt[i][x] = prnt[i - 1][prnt[i - 1][x]];
  for (int i = 0; i < (int)v[x].size(); i++)
    if (v[x][i].first != parent)
      child_size[x] += calc_size(v[x][i].first, x, depth + 1);
  return child_size[x];
}
void build(int x, int parent) {
  int tmp = -1, mx = 0;
  B[x] = ++cnt;
  for (int i = 0; i < (int)v[x].size(); i++)
    if (v[x][i].first != parent && child_size[v[x][i].first] > mx) {
      mx = child_size[v[x][i].first];
      tmp = i;
    }
  if (tmp != -1) {
    dad[v[x][tmp].first] = x;
    build(v[x][tmp].first, x);
  }
  for (int i = 0; i < (int)v[x].size(); i++)
    if (v[x][i].first != parent && i != tmp) build(v[x][i].first, x);
}
node init(int k, int b, int e) {
  if (b == e) return seg[k] = node(0, 0, 0, 1);
  return seg[k] = init(2 * k, b, ((b + e) / 2)) +
                  init(2 * k + 1, ((b + e) / 2) + 1, e);
}
node upd(int k, int b, int e, int a) {
  if (b > a || e < a) return seg[k];
  if (b == e) return seg[k] = node(1, 1, 0, 1);
  return seg[k] = upd(2 * k, b, ((b + e) / 2), a) +
                  upd(2 * k + 1, ((b + e) / 2) + 1, e, a);
}
node fnd(int k, int b, int e, int a1, int a2) {
  if (b > a2 || e < a1) return node(-1, -1, -1, -1);
  if (a1 <= b && e <= a2) return seg[k];
  node l = fnd(2 * k, b, ((b + e) / 2), a1, a2),
       r = fnd(2 * k + 1, ((b + e) / 2) + 1, e, a1, a2);
  if (l.left == -1) return r;
  if (r.left == -1) return l;
  return l + r;
}
int get_lca(int a, int b) {
  if (D[b] > D[a]) swap(a, b);
  for (int i = 19; i >= 0; i--)
    if (D[prnt[i][a]] >= D[b]) a = prnt[i][a];
  if (a == b) return a;
  for (int i = 19; i >= 0; i--)
    if (prnt[i][a] != prnt[i][b]) a = prnt[i][a], b = prnt[i][b];
  return prnt[0][a];
}
node climb(int a, int lca) {
  node t = node(-1, -1, -1, -1);
  int x = a;
  while (D[x] > D[lca]) {
    int y = find(x), z;
    if (D[y] <= D[lca])
      z = B[lca] + 1;
    else
      z = B[y];
    if (t.left == -1)
      t = fnd(1, 1, N, z, B[x]);
    else
      t = fnd(1, 1, N, z, B[x]) + t;
    x = find(x);
    x = prnt[0][x];
  }
  return t;
}
void get(int a, int b, int qq) {
  int lca = get_lca(a, b);
  node l = climb(a, lca), r = climb(b, lca), ret;
  swap(l.left, l.right);
  if (l.left == -1)
    ret = r;
  else if (r.left == -1)
    ret = l;
  else
    ret = l + r;
  if (ret.left == ret.size)
    res[qq] = ar[ret.size];
  else if (ret.left != -1 && ret.right != -1)
    res[qq] = ar[ret.left] + ar[ret.right] + ret.sum;
  else
    res[qq] = ret.sum;
}
int main() {
  cin >> N >> M;
  for (int i = 1; i < N; i++) scanf(" %d", &ar[i]);
  bir = node(1, 1, 0, 1);
  for (int i = 1, a, b, c; i < N; i++) {
    scanf(" %d %d %d", &a, &b, &c);
    v[a].push_back(pair<int, int>(b, c));
    v[b].push_back(pair<int, int>(a, c));
    roads.push_back(R(a, b, c, 0));
  }
  for (int i = 1; i <= N; i++) dad[i] = i;
  sort(roads.begin(), roads.end());
  calc_size(1, 0, 1);
  build(1, 0);
  init(1, 1, N);
  for (int i = 1, a, b, c; i <= M; i++) {
    scanf(" %d %d %d", &a, &b, &c);
    Q.push_back(R(a, b, c, i));
  }
  sort(Q.begin(), Q.end());
  for (int i = 0, j = 0; i < (int)roads.size() || j < (int)Q.size(); j++) {
    while (roads[i].c >= Q[j].c && i < (int)roads.size()) {
      int a = roads[i].a, b = roads[i].b, c = roads[i].c, wh = roads[i].where;
      if (D[b] > D[a]) swap(a, b);
      upd(1, 1, N, B[a]);
      i++;
    }
    get(Q[j].a, Q[j].b, Q[j].where);
  }
  for (int i = 1; i <= M; i++) printf("%d\n", res[i]);
  return 0;
}
