#include <bits/stdc++.h>
using namespace std;
bool rev[100010];
int f[100010];
int pa[100010], son[100010][2], sum[100010], le[100010], ri[100010],
    top[100010], bot[100010], sz[100010];
void init_LCT(int n) {
  for (int i = 0; i <= n; i++) {
    rev[i] = sum[i] = 0;
    top[i] = bot[i] = i;
    sz[i] = 1;
    pa[i] = son[i][0] = son[i][1] = 0;
  }
  sz[0] = 0;
}
int E, head[999983], nxt[2 * 100010];
long long to[2 * 100010];
void add(int u, int v) {
  if (u > v) swap(u, v);
  long long val = (long long)u * 100010 + v;
  int id = val % 999983;
  nxt[E] = head[id];
  to[E] = val;
  head[id] = E++;
}
int added(int u, int v) {
  if (u > v) swap(u, v);
  long long val = (long long)u * 100010 + v;
  int id = val % 999983;
  for (int e = head[id]; e != -1; e = nxt[e]) {
    if (val == to[e]) return 1;
  }
  return 0;
}
void push_up(int x) {
  if (!x) return;
  int L = son[x][0], R = son[x][1];
  sum[x] = sum[L] + sum[R];
  int fl = added(x, top[L]);
  int fr = added(x, bot[R]);
  if (fl) {
    if (fr) {
      sum[x] -= (f[ri[L]] + f[le[R]] - f[ri[L] + le[R] + 2]);
    } else {
      sum[x] -= (f[ri[L]] - f[ri[L] + 1]);
    }
  } else if (fr) {
    sum[x] -= (f[le[R]] - f[le[R] + 1]);
  }
  top[x] = R ? top[R] : x;
  bot[x] = L ? bot[L] : x;
  le[x] = L ? (le[L] == sz[L] - 1
                   ? (fl ? (fr ? le[L] + 2 + le[R] : le[L] + 1) : le[L])
                   : le[L])
            : (fr ? le[R] + 1 : 0);
  ri[x] = R ? (ri[R] == sz[R] - 1
                   ? (fr ? (fl ? ri[R] + 2 + ri[L] : ri[R] + 1) : ri[R])
                   : ri[R])
            : (fl ? ri[L] + 1 : 0);
  sz[x] = sz[L] + sz[R] + 1;
}
void swapp(int x) {
  swap(bot[x], top[x]);
  swap(le[x], ri[x]);
}
void push_down(int x) {
  if (rev[x]) {
    swap(son[x][0], son[x][1]);
    swapp(son[x][0]);
    swapp(son[x][1]);
    rev[son[x][0]] ^= 1;
    rev[son[x][1]] ^= 1;
    rev[x] = 0;
  }
}
bool isroot(int x) { return son[pa[x]][0] != x && son[pa[x]][1] != x; }
void down(int x) {
  if (!isroot(x)) down(pa[x]);
  push_down(x);
}
void rot(int x, int d) {
  int y = pa[x], z = pa[y];
  son[y][!d] = son[x][d];
  pa[son[x][d]] = y;
  pa[x] = pa[y];
  if (son[z][0] == y)
    son[z][0] = x;
  else if (son[z][1] == y)
    son[z][1] = x;
  pa[y] = x;
  son[x][d] = y;
  push_up(y);
}
void splay(int x) {
  down(x);
  while (!isroot(x)) {
    if (isroot(pa[x]))
      rot(x, son[pa[x]][0] == x);
    else {
      int y = pa[x], z = pa[y];
      int d = (son[z][0] == y);
      son[y][d] == x ? rot(x, !d) : rot(y, d);
      rot(x, d);
    }
  }
  push_up(x);
}
void access(int x) {
  for (int y = 0; x; x = pa[x]) {
    splay(x);
    son[x][1] = y;
    push_up(y = x);
  }
}
void make_root(int x) {
  access(x);
  splay(x);
  rev[x] ^= 1;
  swapp(x);
}
void link(int x, int y) {
  make_root(x);
  splay(x);
  pa[x] = y;
}
void cut(int x, int y) {
  make_root(x);
  splay(y);
  pa[son[y][0]] = pa[y];
  pa[y] = son[y][0] = 0;
}
int getpa(int v) {
  access(v);
  splay(v);
  while (son[v][0]) v = son[v][0];
  splay(v);
  return v;
}
pair<pair<int, int>, pair<int, int> > query[2 * 100010];
vector<int> adj[100010];
void dfs(int u) {
  for (int i = adj[u].size(); i--;) {
    int v = adj[u][i];
    if (v == pa[u]) continue;
    pa[v] = u;
    dfs(v);
  }
}
bool cmp(pair<pair<int, int>, pair<int, int> > a,
         pair<pair<int, int>, pair<int, int> > b) {
  return a > b;
}
int ans[100010];
int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 1; i < n; i++) scanf("%d", f + i);
  int m = 0, u, v, w;
  for (int i = 1; i < n; i++) {
    scanf("%d %d %d", &u, &v, &w);
    adj[u].push_back(v);
    adj[v].push_back(u);
    query[m++] = pair<pair<int, int>, pair<int, int> >(
        pair<int, int>(w, 100010), pair<int, int>(u, v));
  }
  init_LCT(n);
  dfs(1);
  for (int i = 0; i < q; i++) {
    scanf("%d %d %d", &u, &v, &w);
    query[m++] = pair<pair<int, int>, pair<int, int> >(pair<int, int>(w, i),
                                                       pair<int, int>(u, v));
  }
  memset(head, -1, sizeof(head));
  sort(query, query + m, cmp);
  for (int i = 0; i < m; i++) {
    pair<pair<int, int>, pair<int, int> > pp = query[i];
    u = pp.second.first, v = pp.second.second;
    if (pp.first.second == 100010) {
      make_root(u);
      access(u);
      add(u, v);
    } else {
      make_root(v);
      access(u);
      splay(u);
      ans[pp.first.second] = sum[u];
    }
  }
  for (int i = 0; i < q; i++) printf("%d\n", ans[i]);
  return 0;
}
