#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
using ld = long double;
using uint = uint32_t;
const double EPS = 1e-8;
const int INF = 0x3F3F3F3F;
const ll LINF = 4611686018427387903;
const int MOD = 1e9 + 7;
const int N = 1e5 + 25;
int pa[N], ch[N][2];
ll dis[N], prv[N], tag[N];
vector<pair<int, int>> edge[N];
vector<pair<ll, ll>> eve;
inline bool dir(int x) { return ch[pa[x]][1] == x; }
inline bool is_root(int x) { return ch[pa[x]][0] != x && ch[pa[x]][1] != x; }
inline void rotate(int x) {
  int y = pa[x], z = pa[y], d = dir(x);
  if (!is_root(y)) ch[z][dir(y)] = x;
  pa[x] = z;
  ch[y][d] = ch[x][!d];
  if (ch[x][!d]) pa[ch[x][!d]] = y;
  ch[x][!d] = y;
  pa[y] = x;
}
inline void push_tag(int x) {
  if (!tag[x]) return;
  prv[x] = tag[x];
  if (ch[x][0]) tag[ch[x][0]] = tag[x];
  if (ch[x][1]) tag[ch[x][1]] = tag[x];
  tag[x] = 0;
}
void push(int x) {
  if (!is_root(x)) push(pa[x]);
  push_tag(x);
}
inline void splay(int x) {
  push(x);
  while (!is_root(x)) {
    if (int y = pa[x]; !is_root(y)) rotate(dir(y) == dir(x) ? y : x);
    rotate(x);
  }
}
inline void access(ll t, int x) {
  int lst = 0, tx = x;
  while (x) {
    splay(x);
    if (lst) {
      ch[x][1] = lst;
      eve.push_back({prv[x] + dis[x], t + dis[x]});
    }
    lst = x;
    x = pa[x];
  }
  splay(tx);
  if (ch[tx][0]) tag[ch[tx][0]] = t;
}
void dfs(int u) {
  prv[u] = -LINF;
  for (const auto &[v, c] : edge[u]) {
    if (v == pa[u]) continue;
    pa[v] = u;
    ch[u][1] = v;
    dis[v] = dis[u] + c;
    dfs(v);
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int n, q;
  cin >> n >> q;
  for (int i = 1, a, b, c; i < n; i++) {
    cin >> a >> b >> c;
    edge[a].push_back({b, c});
    edge[b].push_back({a, c});
  }
  dfs(1);
  while (q--) {
    int s, t;
    cin >> s >> t;
    access(t, s);
  }
  sort(eve.begin(), eve.end());
  priority_queue<ll, vector<ll>, greater<ll>> pq;
  priority_queue<ll> used;
  int it = 0;
  ll cur = 1;
  while (it < eve.size() || !pq.empty()) {
    while (it < eve.size() && eve[it].first < cur) pq.push(eve[it++].second);
    if (pq.empty()) {
      cur = eve[it].first + 1;
    } else {
      if (cur > pq.top()) {
        while (!used.empty() && used.top() >= pq.top()) used.pop();
        cout << pq.top() << ' ' << used.size() << '\n';
        return 0;
      }
      used.push(pq.top());
      pq.pop();
      cur++;
    }
  }
  cout << -1 << ' ' << used.size() << '\n';
}
