#include <bits/stdc++.h>
using namespace std;
long long inf;
const double eps = 1e-8;
const double pi = acos(-1.0);
template <class T, class T2>
long long chkmin(T &a, T2 b) {
  return a > b ? a = b, 1 : 0;
}
template <class T, class T2>
long long chkmax(T &a, T2 b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
T sqr(T a) {
  return a * a;
}
template <class T, class T2>
T mmin(T a, T2 b) {
  return a < b ? a : b;
}
template <class T, class T2>
T mmax(T a, T2 b) {
  return a > b ? a : b;
}
template <class T>
T aabs(T a) {
  return a < 0 ? -a : a;
}
template <class T>
long long dcmp(T a, T b) {
  return a > b;
}
template <long long *a>
long long cmp_a(long long first, long long second) {
  return a[first] < a[second];
}
struct __INIT__ {
  __INIT__() { memset(&inf, 0x3f, sizeof(inf)); }
} __INIT___;
namespace io {
const long long SIZE = (1 << 21) + 1;
char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c,
                                       qu[55];
long long f, qr;
inline void flush() {
  fwrite(obuf, 1, oS - obuf, stdout);
  oS = obuf;
}
inline void putc(char first) {
  *oS++ = first;
  if (oS == oT) flush();
}
template <typename A>
inline bool read(A &first) {
  for (f = 1, c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                              (iS == iT ? EOF : *iS++))
                            : *iS++);
       c < '0' || c > '9';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    if (c == '-')
      f = -1;
    else if (c == EOF)
      return 0;
  for (first = 0; c <= '9' && c >= '0';
       c = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                       (iS == iT ? EOF : *iS++))
                     : *iS++))
    first = first * 10 + (c & 15);
  first *= f;
  return 1;
}
inline bool read(char &first) {
  while ((first = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                               (iS == iT ? EOF : *iS++))
                            : *iS++)) == ' ' ||
         first == '\n' || first == '\r')
    ;
  return first != EOF;
}
inline bool read(char *first) {
  while ((*first = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                                (iS == iT ? EOF : *iS++))
                             : *iS++)) == '\n' ||
         *first == ' ' || *first == '\r')
    ;
  if (*first == EOF) return 0;
  while (!(*first == '\n' || *first == ' ' || *first == '\r' || *first == EOF))
    *(++first) = (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, SIZE, stdin),
                              (iS == iT ? EOF : *iS++))
                           : *iS++);
  *first = 0;
  return 1;
}
template <typename A, typename... B>
inline bool read(A &first, B &...second) {
  return read(first) && read(second...);
}
template <typename A>
inline bool write(A first) {
  if (!first) putc('0');
  if (first < 0) putc('-'), first = -first;
  while (first) qu[++qr] = first % 10 + '0', first /= 10;
  while (qr) putc(qu[qr--]);
  return 0;
}
inline bool write(char first) {
  putc(first);
  return 0;
}
inline bool write(const char *first) {
  while (*first) {
    putc(*first);
    ++first;
  }
  return 0;
}
inline bool write(char *first) {
  while (*first) {
    putc(*first);
    ++first;
  }
  return 0;
}
template <typename A, typename... B>
inline bool write(A first, B... second) {
  return write(first) || write(second...);
}
struct Flusher_ {
  ~Flusher_() { flush(); }
} io_flusher_;
}  // namespace io
using io ::putc;
using io ::read;
using io ::write;
vector<pair<long long, long long> > to[100005];
long long las[100005];
vector<long long> hv[100005];
long long t[100005], col[100005];
set<long long> st[100005];
multiset<pair<long long, long long> > mt;
priority_queue<long long, vector<long long>, greater<long long> > pq;
void put_ans(long long cur) {
  write(cur, ' ');
  long long ans = 0;
  for (auto i : mt)
    if (i.second < cur) ++ans;
  write(ans, '\n');
  exit(0);
}
long long dep[100005], ndep;
void add(long long first, long long second) {
  if (col[first] != col[second]) {
    mt.insert(make_pair(t[first] + ndep + 1, t[second] + ndep));
  }
}
void del(long long first, long long second) {
  if (col[first] != col[second]) {
    mt.erase(mt.lower_bound(make_pair(t[first] + ndep + 1, t[second] + ndep)));
  }
}
void dfs(long long first) {
  for (auto i : to[first]) {
    dep[i.first] = dep[first] + i.second;
    dfs(i.first);
  }
  t[0] = -dep[first];
  st[las[first]].insert(0);
  for (auto i : to[first]) {
    if (st[first].size() < st[i.first].size()) {
      swap(st[first], st[i.first]);
    }
  }
  long long c = 0;
  ndep = dep[first];
  for (auto i : to[first]) {
    ++c;
    for (auto j : st[i.first]) {
      col[j] = c;
      auto it = st[first].lower_bound(j);
      if (it == st[first].end()) {
        --it;
        add(*it, j);
      } else if (it == st[first].begin()) {
        add(j, *it);
      } else {
        auto it2 = it;
        --it2;
        del(*it2, *it);
        add(*it2, j);
        add(j, *it);
      }
      st[first].insert(j);
    }
  }
  c = 0;
  for (auto i : to[first]) {
    ++c;
    for (auto j : st[i.first]) {
      col[j] = 0;
    }
    st[i.first].clear();
  }
  st[first].erase(0);
  for (auto i : hv[first]) st[first].insert(i);
}
signed main() {
  long long n, m, u, v, c;
  read(n, m);
  for (long long i = 1; i < n; ++i) {
    read(u, v, c);
    to[u].push_back(make_pair(v, c));
    las[u] = v;
  }
  for (long long i = 1; i <= m; ++i) {
    long long first;
    read(first, t[i]);
    hv[first].push_back(i);
  }
  dfs(1);
  long long cur = 0;
  auto it = mt.begin();
  while (1) {
    ++cur;
    if (pq.empty()) {
      if (it == mt.end()) break;
      cur = it->first;
    }
    while (it != mt.end() && it->first == cur) {
      pq.push(it->second);
      ++it;
    }
    if (pq.top() < cur) {
      put_ans(pq.top());
    }
    pq.pop();
  }
  write(-1, ' ', mt.size(), '\n');
  return 0;
}
