#include <bits/stdc++.h>
namespace IO {
char gc() { return getchar(); }
template <typename Tp>
bool get1(Tp &x) {
  bool neg = 0;
  char c = gc();
  while (c != EOF && (c < '0' || c > '9') && c != '-') c = gc();
  if (c == '-') c = gc(), neg = 1;
  if (c == EOF) return false;
  x = 0;
  for (; c >= '0' && c <= '9'; c = gc()) x = x * 10 + c - '0';
  if (neg) x = -x;
  return true;
}
template <typename Tp>
void printendl(Tp x) {
  if (x < 0) putchar('-'), x = -x;
  static short a[40], sz;
  sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
  puts("");
}
}  // namespace IO
using IO::get1;
using IO::printendl;
const int inf = 0x3f3f3f3f;
const long long Linf = 1ll << 61;
const int maxn = 100111;
struct node {
  int ch[2], fa;
  long long tag, val;
  node() { ch[0] = ch[1] = fa = tag = val = 0; }
  void Tag(long long v) { tag = val = v; }
};
node a[maxn];
inline int gettp(int o) {
  int f = a[o].fa;
  return a[f].ch[0] == o ? 0 : (a[f].ch[1] == o ? 1 : -1);
}
void pushdown(int o) {
  if (a[o].tag) {
    a[a[o].ch[0]].Tag(a[o].tag);
    a[a[o].ch[1]].Tag(a[o].tag);
    a[o].tag = 0;
  }
}
void pushup(int o) {
  if (gettp(o) != -1) pushup(a[o].fa);
  pushdown(o);
}
void rotate(int o, int d) {
  int k1 = a[o].ch[d], k2 = a[k1].ch[d ^ 1];
  if (gettp(o) != -1) a[a[o].fa].ch[gettp(o)] = k1;
  a[o].ch[d] = k2;
  a[k1].ch[d ^ 1] = o;
  a[k1].fa = a[o].fa;
  a[o].fa = k1;
  a[k2].fa = o;
}
void splay(int o) {
  pushup(o);
  while (gettp(o) != -1) {
    int f1 = a[o].fa, f2 = a[f1].fa, t1 = gettp(o), t2 = gettp(f1);
    if (t2 == -1 || f2 == 0)
      rotate(f1, t1);
    else if (t1 == t2) {
      rotate(f2, t2);
      rotate(f1, t1);
    } else {
      rotate(f1, t1);
      rotate(f2, t2);
    }
  }
}
std::vector<int> g[maxn], l[maxn];
long long dep[maxn];
int n, m, fa[maxn];
void access(int o, std::vector<std::pair<long long, long long>> &need,
            long long nT) {
  splay(o);
  int O = o, lastc = a[o].ch[1];
  long long OV = a[o].val;
  int k = 0;
  while (o) {
    splay(o);
    if (k)
      need.emplace_back((a[o].val == 0 ? 1 : a[o].val + dep[o] + 1),
                        nT + dep[o]);
    a[o].ch[1] = k;
    k = o;
    o = a[o].fa;
  }
  a[k].Tag(nT);
  splay(O);
  a[O].val = OV;
  a[O].ch[1] = lastc;
}
void dfs(int x) {
  for (int i = 0; i < (int)g[x].size(); i++) {
    fa[g[x][i]] = x;
    a[g[x][i]].fa = x;
    a[x].ch[1] = g[x][i];
    dep[g[x][i]] = dep[x] + l[x][i];
    dfs(g[x][i]);
  }
}
int main() {
  get1(n) && get1(m);
  for (int i = 1, u, v, w; i < n; i++) {
    get1(u) && get1(v) && get1(w);
    g[u].push_back(v);
    l[u].push_back(w);
  }
  dfs(1);
  std::vector<std::pair<long long, long long>> need;
  for (int i = 1, x, curT; i <= m; i++) {
    get1(x) && get1(curT);
    access(x, need, curT);
  }
  std::sort(need.begin(), need.end());
  std::priority_queue<long long, std::vector<long long>,
                      std::greater<long long>>
      ddl;
  int pos = 0;
  long long curT = 0;
  while (pos < need.size() || !ddl.empty()) {
    while (pos < need.size() && need[pos].first <= curT) {
      ddl.push(need[pos].second);
      pos++;
    }
    if (!ddl.empty()) {
      long long now = ddl.top();
      ddl.pop();
      if (now >= curT) {
        curT++;
        continue;
      } else {
        int ans = 0;
        for (auto v : need)
          if (v.second < now) ans++;
        printf("%lld %d\n", now, ans);
        return 0;
      }
    } else
      curT = need[pos].first;
  }
  printf("-1 %d\n", need.size());
  return 0;
}
