#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 0;
  char ch = getchar();
  while (!isdigit(ch)) f = ch == '-', ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return f ? -x : x;
}
const int N = 100005;
int n, m;
vector<pair<int, int> > e[N];
long long dep[N];
void dfs(int x, long long d) {
  dep[x] = d;
  for (auto E : e[x]) dfs(E.first, d + E.second);
}
vector<pair<long long, long long> > v;
namespace lct {
int fa[N], son[N][2];
long long val[N], tag[N];
int isroot(int x) { return son[fa[x]][0] != x && son[fa[x]][1] != x; }
int wson(int x) { return son[fa[x]][1] == x; }
void rotate(int x) {
  int y = fa[x], z = fa[y], L = wson(x), R = L ^ 1;
  if (!isroot(y)) son[z][wson(y)] = x;
  fa[x] = z, fa[y] = x, fa[son[x][R]] = y;
  son[y][L] = son[x][R], son[x][R] = y;
}
void pushson(int x, long long v) {
  val[x] = max(val[x], v);
  tag[x] = max(tag[x], v);
}
void pushdown(int x) {
  if (tag[x]) {
    pushson(son[x][0], tag[x]);
    pushson(son[x][1], tag[x]);
    tag[x] = 0;
  }
}
void pushadd(int x) {
  if (!isroot(x)) pushadd(fa[x]);
  pushdown(x);
}
void splay(int x) {
  pushadd(x);
  for (int y = fa[x]; !isroot(x); rotate(x), y = fa[x])
    if (!isroot(y)) rotate(wson(x) == wson(y) ? y : x);
}
void access(int x, long long start_time) {
  int _x = x;
  int t = 0;
  while (x) {
    splay(x);
    if (x != _x) {
      v.push_back(make_pair(val[x] == 0 ? 1 : val[x] + dep[x] + 1,
                            start_time + dep[x]));
    }
    if (x != _x) son[x][1] = t;
    t = x;
    x = fa[x];
  }
  x = _x;
  splay(x);
  if (son[x][0]) {
    int y = son[x][0];
    pushson(son[x][0], start_time);
  }
}
}  // namespace lct
void gao(long long res) {
  printf("%lld ", res);
  if (res == -1) res = 1e18;
  int cnt = 0;
  for (auto i : v) cnt += i.second < res;
  printf("%d\n", cnt);
  exit(0);
}
int main() {
  n = read(), m = read();
  for (int i = (1); i <= (n - 1); i++) {
    int x = read(), y = read(), z = read();
    e[x].push_back(make_pair(y, z));
    lct::fa[y] = x, lct::son[x][1] = y;
  }
  dfs(1, 0);
  for (int i = (1); i <= (m); i++) {
    int s = read(), t = read();
    lct::access(s, t);
  }
  sort(v.begin(), v.end());
  priority_queue<long long, vector<long long>, greater<long long> > q;
  long long t = 1;
  for (auto p : v) {
    while (!q.empty() && t < p.first) {
      if (q.top() < t) gao(q.top());
      q.pop();
      t++;
    }
    t = max(t, p.first);
    q.push(p.second);
  }
  while (!q.empty()) {
    if (q.top() < t) gao(q.top());
    q.pop();
    t++;
  }
  gao(-1);
  return 0;
}
