#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int res = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (isdigit(ch)) {
    res = res * 10 + ch - '0';
    ch = getchar();
  }
  return res * f;
}
namespace qiqi {
const int N = 1e5 + 5;
const long long INF = 0x3f3f3f3f3f3f3f3f;
int n, Q, fa[N], ch[N][2], val[N], tag[N], head[N], ecnt, top;
long long d[N];
pair<long long, long long> a[N * 50];
multiset<long long> s;
struct Edge {
  int v, w, nxt;
} e[N];
inline void add(int u, int v, int w) {
  e[++ecnt] = (Edge){v, w, head[u]};
  head[u] = ecnt;
}
void dfs(int u) {
  for (int i = head[u], v = e[i].v; i; v = e[i = e[i].nxt].v) {
    d[v] = d[u] + e[i].w;
    dfs(v);
  }
}
inline bool isroot(int x) { return x != ch[fa[x]][0] && x != ch[fa[x]][1]; }
void push_down(int x, int k) {
  if (k && !isroot(x)) push_down(fa[x], 1);
  if (tag[x]) {
    val[ch[x][0]] = val[ch[x][1]] = tag[ch[x][0]] = tag[ch[x][1]] = tag[x];
    tag[x] = 0;
  }
}
inline void rotate(int x) {
  int y = fa[x], z = fa[y], l = ch[y][1] == x;
  if (!isroot(y)) ch[z][ch[z][1] == y] = x;
  fa[x] = z;
  fa[ch[y][l] = ch[x][l ^ 1]] = y;
  fa[ch[x][l ^ 1] = y] = x;
}
inline void splay(int x) {
  push_down(x, 1);
  while (!isroot(x)) {
    int y = fa[x];
    if (!isroot(y)) rotate(x ^ y ^ ch[y][0] ^ ch[fa[y]][0] ? x : y);
    rotate(x);
  }
}
inline int find(int x) {
  while (ch[x][0]) x = ch[x][0];
  return x;
}
inline void access(int x, int k) {
  for (int i = 0; x; x = fa[i = x]) {
    splay(x);
    if (ch[x][0]) val[ch[x][0]] = tag[ch[x][0]] = k;
    if (i) {
      a[++top] =
          pair<long long, long long>(val[x] ? val[x] + d[x] + 1 : 1, d[x] + k);
      val[x] = k;
      ch[x][1] = i;
    }
  }
}
void main() {
  int x, y, k;
  n = read();
  Q = read();
  for (int i = (1); i <= (n - 1); ++i) {
    x = read();
    y = read();
    k = read();
    add(x, y, k);
    fa[ch[x][1] = y] = x;
  }
  dfs(1);
  while (Q--) {
    x = read();
    y = read();
    access(x, y);
  }
  sort(a + 1, a + top + 1);
  long long ans = 0;
  x = 1;
  while (1) {
    ++ans;
    while (a[x].first <= ans && x <= top) s.insert(a[x++].second);
    if (s.empty()) {
      if (x > top) break;
      ans = a[x].first - 1;
      continue;
    }
    if (*s.begin() < ans) {
      x = 0;
      for (int i = (1); i <= (top); ++i)
        if (a[i].second < ans - 1) ++x;
      printf("%lld %d\n", ans - 1, x);
      return;
    }
    s.erase(s.begin());
  }
  printf("-1 %d\n", top);
}
}  // namespace qiqi
int main() {
  qiqi::main();
  return 0;
}
