#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int M = 3000005;
int n, Q, top;
long long dep[N];
pair<long long, long long> opt[M];
namespace LCT {
int fa[N], cov[N], tag[N], ch[N][2];
bool isroot(int x) { return ch[fa[x]][0] != x && ch[fa[x]][1] != x; }
void pushdown(int x) {
  if (!tag[x]) return;
  if (ch[x][0]) cov[ch[x][0]] = tag[ch[x][0]] = cov[x];
  if (ch[x][1]) cov[ch[x][1]] = tag[ch[x][1]] = cov[x];
  tag[x] = 0;
}
void Down(int x) {
  if (!isroot(x)) Down(fa[x]);
  pushdown(x);
}
void rotate(int x) {
  int y = fa[x], z = fa[y];
  int l = (ch[y][1] == x), r = l ^ 1;
  if (!isroot(y)) ch[z][ch[z][1] == y] = x;
  fa[x] = z;
  fa[y] = x;
  fa[ch[x][r]] = y;
  ch[y][l] = ch[x][r];
  ch[x][r] = y;
}
void splay(int x) {
  Down(x);
  for (; !isroot(x); rotate(x)) {
    int y = fa[x], z = fa[y];
    if (!isroot(y)) rotate((ch[y][0] == x) ^ (ch[z][0] == y) ? x : y);
  }
}
void access(int x, int T) {
  int fir = 0;
  for (int y = 0; x; y = x, x = fa[x]) {
    splay(x);
    if (!fir) {
      fir = 1;
      if (ch[x][0] && T != -1) cov[ch[x][0]] = tag[ch[x][0]] = T;
      continue;
    }
    if (T != -1) {
      long long tl = (cov[x] ? cov[x] + dep[x] + 1 : 1);
      long long tr = dep[x] + T;
      opt[++top] = pair<long long, long long>(tl, tr);
      cov[x] = T;
      if (ch[x][0] && T != -1) cov[ch[x][0]] = tag[ch[x][0]] = T;
    }
    ch[x][1] = y;
  }
}
}  // namespace LCT
vector<pair<int, int> > e[N];
multiset<long long> S;
void dfs(int x) {
  LCT::access(x, -1);
  for (auto i : e[x]) dep[i.first] = dep[x] + i.second, dfs(i.first);
}
int main() {
  scanf("%d%d", &n, &Q);
  for (int i = (int)(1); i <= (int)(n - 1); i++) {
    int x, y, v;
    scanf("%d%d%d", &x, &y, &v);
    e[x].push_back(pair<int, int>(y, v));
    LCT::fa[y] = x;
  }
  dfs(1);
  for (int i = (int)(1); i <= (int)(Q); i++) {
    int x, T;
    scanf("%d%d", &x, &T);
    LCT::access(x, T);
  }
  sort(opt + 1, opt + top + 1);
  long long nowT = 0;
  int pos = 1;
  for (;;) {
    ++nowT;
    for (; opt[pos].first <= nowT && pos <= top; ++pos)
      S.insert(opt[pos].second);
    if (!S.size()) {
      if (pos > top) break;
      nowT = opt[pos].first - 1;
      continue;
    }
    if (*S.begin() < nowT) {
      int sum = 0;
      for (int i = (int)(1); i <= (int)(top); i++)
        sum += (opt[i].second < nowT - 1);
      printf("%lld %d\n", nowT - 1, sum);
      return 0;
    }
    S.erase(S.begin());
  }
  printf("-1 %d\n", top);
}
