#include <bits/stdc++.h>
using namespace std;
template <class T>
int chkmax(T &a, T b) {
  if (b > a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
int chkmin(T &a, T b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class iterator>
void output(iterator begin, iterator end, ostream &out = cerr) {
  while (begin != end) {
    out << (*begin) << " ";
    begin++;
  }
  out << endl;
}
template <class T>
void output(T x, ostream &out = cerr) {
  output(x.begin(), x.end(), out);
}
void fast_io() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int mx = 1e5 + 228;
int n, m;
long long up_len[mx], total_len[mx], last_child[mx];
vector<vector<int> > children;
vector<vector<long long> > trains_by_dest;
void calc_total_len(int v) {
  for (auto v1 : children[v]) {
    total_len[v1] = total_len[v] + up_len[v1];
    calc_total_len(v1);
  }
}
void read() {
  cin >> n >> m;
  children.resize(n);
  for (int i = 0; i < n - 1; ++i) {
    int u, v, d;
    cin >> u >> v >> d;
    u--;
    v--;
    last_child[u] = v;
    up_len[v] = d;
    children[u].push_back(v);
  }
  calc_total_len(0);
  trains_by_dest.resize(n);
  for (int i = 0; i < m; ++i) {
    int s, t;
    cin >> s >> t;
    s--;
    trains_by_dest[s].push_back((long long)t + total_len[s]);
  }
}
struct ModSet : set<long long> {
  long long mod = 0;
};
const long long INF = 1e18;
void print(ModSet *p) {
  for (auto x : *p) {
    cerr << x + p->mod << " ";
  }
  cerr << endl;
}
ModSet *merge(ModSet *a, ModSet *b, set<long long> &coords) {
  if (a->size() > b->size()) {
    swap(a, b);
  }
  long long last_lb = -1;
  for (auto x : (*a)) {
    long long y = x + a->mod - b->mod;
    auto it = b->lower_bound(y);
    long long new_lb = (it == b->end() ? INF : (*it));
    if (new_lb != last_lb) {
      if (it != b->begin()) {
        coords.insert(x + a->mod);
      }
      if (new_lb != INF) {
        coords.insert(new_lb + b->mod);
      }
      last_lb = new_lb;
    }
    b->insert(y);
  }
  return b;
}
vector<vector<long long> > events;
void addSegment(long long l, long long r) {
  events.push_back({l, 1, r});
  events.push_back({r, -1, l});
}
ModSet *dfs(int v) {
  set<long long> coords;
  ModSet *cur = new ModSet();
  long long minimal = INF;
  int minimal_color = -1;
  for (auto v1 : children[v]) {
    ModSet *ch = dfs(v1);
    if (!ch->empty() && chkmin(minimal, *(ch->begin()) + ch->mod)) {
      minimal_color = v1;
    }
    cur = merge(cur, ch, coords);
  }
  if (minimal_color != last_child[v] && minimal != INF) {
    addSegment(0, minimal);
  }
  for (auto x : coords) {
    auto it = cur->lower_bound(x - cur->mod);
    if (it != cur->begin()) {
      addSegment((*prev(it)) + cur->mod, x);
    }
  }
  for (auto t : trains_by_dest[v]) {
    cur->insert(t - cur->mod);
  }
  cur->mod -= up_len[v];
  return cur;
}
void scanline() {
  sort(events.begin(), events.end());
  multiset<long long> rbounds;
  long long survive = INF;
  for (int i = 0; i < events.size(); ++i) {
    if (events[i][1] == 1) {
      rbounds.insert(events[i][2]);
    } else {
      if (rbounds.find(events[i][0]) != rbounds.end()) {
        survive = events[i][0];
        break;
      }
    }
    if (i < (int)events.size() - 1) {
      for (long long j = 0; j < events[i + 1][0] - events[i][0]; ++j) {
        if (rbounds.empty()) {
          break;
        }
        rbounds.erase(rbounds.begin());
      }
    }
  }
  int cnt = 0;
  for (auto ev : events) {
    if (ev[1] == -1 && ev[0] < survive) {
      cnt++;
    }
  }
  if (survive == INF) {
    survive = -1;
  }
  cout << survive << " " << cnt << endl;
}
signed main() {
  fast_io();
  read();
  dfs(0);
  scanline();
}
