#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
long long len[N];
int son[N], Time[N], sz[N], fa[N], vis[N], last[N];
vector<pair<int, int> > p[N];
vector<pair<long long, long long> > res;
vector<int> g[N];
set<int> s;
void dfs(int x, long long r) {
  sz[x] = g[x].size();
  son[x] = -1;
  len[x] = r;
  for (int i = 0; i < p[x].size(); i++) {
    int v = p[x][i].first;
    dfs(v, r + p[x][i].second);
    sz[x] += sz[v];
    if (son[x] == -1 || sz[son[x]] < sz[v]) son[x] = v;
  }
}
void getfa(int x, int y) {
  fa[x] = y;
  if (son[x] != -1) getfa(son[x], y);
  for (int i = 0; i < p[x].size(); i++)
    if (p[x][i].first != son[x]) {
      getfa(p[x][i].first, p[x][i].first);
    }
}
vector<int> vec;
void get(int x) {
  for (int i = 0; i < g[x].size(); i++) vec.push_back(g[x][i]);
  for (int i = 0; i < p[x].size(); i++) {
    int v = p[x][i].first;
    get(v);
  }
}
void gao(int x) {
  for (int i = 0; i < p[x].size(); i++) {
    int v = p[x][i].first;
    if (v != son[x]) {
      gao(v);
      s.clear();
    }
  }
  if (son[x] != -1) gao(son[x]);
  vec.clear();
  for (int i = 0; i < p[x].size(); i++) {
    int v = p[x][i].first;
    if (v != son[x]) {
      get(v);
    }
  }
  if (vec.size()) {
    for (int i = 0; i < vec.size(); i++) s.insert(vec[i]);
    int t = fa[x], fi = p[x][p[x].size() - 1].first;
    for (int i = 0; i < vec.size(); i++) {
      set<int>::iterator it = s.lower_bound(vec[i]);
      if (it == s.begin()) {
        int q = vis[(*it)] == t ? son[x] : vis[(*it)];
        if (q != fi) {
          int o = *it;
          res.push_back(make_pair(len[x] + Time[o], 0));
        }
      } else {
        if (vis[*it] != vis[*(--it)]) {
          int o = *(++it), oo = *(--it);
          res.push_back(make_pair(len[x] + Time[o], len[x] + Time[oo]));
        }
      }
      it = s.lower_bound(vec[i]);
      if (++it != s.end()) {
        if (vis[*it] == t) {
          int o = *(it), oo = *(--it);
          res.push_back(make_pair(len[x] + Time[o], len[x] + Time[oo]));
        }
      }
    }
  }
  if (s.size()) {
    set<int>::iterator it = s.begin();
    if (vis[*it] == fa[x] && p[x][p[x].size() - 1].first != son[x]) {
      res.push_back(make_pair(len[x] + Time[*it], 0));
    }
  }
  for (int i = 0; i < vec.size(); i++) vis[vec[i]] = fa[x];
  for (int i = 0; i < g[x].size(); i++) {
    s.insert(g[x][i]);
    vis[g[x][i]] = fa[x];
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; i++) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    p[u].push_back(make_pair(v, w));
  }
  for (int i = 1; i <= m; i++) {
    int s;
    scanf("%d%d", &s, &Time[i]);
    g[s].push_back(i);
  }
  dfs(1, 0);
  getfa(1, 1);
  gao(1);
  for (int i = 0; i < res.size(); i++) {
    swap(res[i].first, res[i].second);
    res[i].first++;
  }
  sort(res.begin(), res.end());
  long long ans1 = -1, now = 1;
  int ans2 = 0;
  int i = 0, len = res.size();
  priority_queue<long long, vector<long long>, greater<long long> > Q;
  while (i < len || !Q.empty()) {
    while (!Q.empty()) {
      while (i < len && res[i].first <= now) {
        Q.push(res[i].second);
        i++;
      }
      if (now > Q.top()) {
        ans1 = Q.top();
        break;
      } else {
        Q.pop();
        now += 1;
      }
    }
    if (ans1 != -1) break;
    if (i < len) {
      now = res[i].first;
      Q.push(res[i].second);
      i++;
    }
  }
  for (int i = 0; i < res.size(); i++) {
    if (ans1 == -1 || res[i].second < ans1) {
      ans2++;
    }
  }
  printf("%lld %d", ans1, ans2);
  return 0;
}
