#include <bits/stdc++.h>
const int MAXN = 1e5 + 5;
int n, m;
struct Edge {
  int to, w, nxt;
} e[MAXN << 1];
int head[MAXN], cnt;
inline void add(int u, int v, int w) {
  e[++cnt] = (Edge){v, w, head[u]};
  head[u] = cnt;
}
long long dis[MAXN];
inline void dfs(int v) {
  for (int i = head[v]; i; i = e[i].nxt) {
    dis[e[i].to] = dis[v] + e[i].w;
    dfs(e[i].to);
  }
}
int ch[MAXN][2], fa[MAXN];
long long tag[MAXN], ts[MAXN];
inline bool nroot(int x) { return ch[fa[x]][0] == x || ch[fa[x]][1] == x; }
inline void rotate(int x) {
  int y = fa[x], z = fa[y], k = ch[y][1] == x, w = ch[x][!k];
  if (nroot(y)) ch[z][ch[z][1] == y] = x;
  fa[x] = z;
  ch[x][!k] = y;
  fa[y] = x;
  ch[y][k] = w;
  if (w) fa[w] = y;
}
inline void pushdown(int x) {
  if (tag[x] != -1) {
    if (ch[x][0]) tag[ch[x][0]] = ts[ch[x][0]] = tag[x];
    if (ch[x][1]) tag[ch[x][1]] = ts[ch[x][1]] = tag[x];
    tag[x] = -1;
  }
}
int st[MAXN];
inline void splay(int x) {
  int y = x, z;
  st[z = 1] = y;
  while (nroot(y)) st[++z] = y = fa[y];
  while (z) pushdown(st[z--]);
  while (nroot(x)) {
    y = fa[x], z = fa[y];
    if (nroot(y)) rotate((ch[z][1] == y) ^ (ch[y][1] == x) ? x : y);
    rotate(x);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 2; i <= n; ++i) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    add(u, v, w);
    ch[u][1] = v;
    fa[v] = u;
  }
  dfs(1);
  for (int i = 1; i <= n; ++i) tag[i] = -1, ts[i] = -dis[i];
  std::vector<std::pair<long long, long long> > S;
  while (m--) {
    int s, t;
    scanf("%d%d", &s, &t);
    splay(s);
    for (int x = fa[s], y = s; x; y = x, x = fa[x]) {
      splay(x);
      ch[x][1] = y;
      S.push_back(std::make_pair(ts[x] + dis[x] + 1, t + dis[x]));
    }
    splay(s);
    if (ch[s][0]) tag[ch[s][0]] = ts[ch[s][0]] = t;
  }
  std::sort(S.begin(), S.end());
  long long now = 0;
  int cnt = 0;
  std::priority_queue<long long, std::vector<long long>,
                      std::greater<long long> >
      q;
  for (int i = 0; i <= (int)S.size() - 1; ++i) {
    while (!q.empty() && now < S[i].first) {
      long long r = q.top();
      q.pop();
      if (now > r) {
        for (int j = 0; j <= i - 1; ++j) cnt -= (S[j].second >= r);
        while (!q.empty()) cnt += (q.top() >= r), q.pop();
        printf("%lld %d\n", r, cnt + 1);
        return 0;
      }
      now++;
      ++cnt;
    }
    if (now < S[i].first) now = S[i].first;
    q.push(S[i].second);
  }
  while (!q.empty()) {
    long long r = q.top();
    q.pop();
    if (now > r) {
      for (auto x : S) cnt -= (x.second >= r);
      while (!q.empty()) cnt += (q.top() >= r), q.pop();
      printf("%lld %d\n", r, cnt + 1);
      return 0;
    }
    ++now;
    ++cnt;
  }
  printf("-1 %d\n", cnt);
  return 0;
}
