#include <bits/stdc++.h>   using namespace std;   long long mod = 1e9 + 9;   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     long long n, m;     cin >> n >> m;     vector<vector<long long>> v(n);     vector<vector<long long>> vr(n);     long long a, b;     for (int i = 0; i < m; ++i) {       cin >> a >> b;       a--;       b--;       v[a].push_back(b);       vr[b].push_back(a);     }     vector<long long> mr(n, 0);     long long ps;     cin >> ps;     vector<long long> p(ps);     for (int i = 0; i < ps; ++i) {       cin >> p[i];       p[i]--;     }     mr[p[ps - 1]] = 0;     queue<int> q;     q.push(p[ps - 1]);     vector<bool> used(n);     used[p[ps - 1]] = true;     while (!q.empty()) {       long long cur = q.front();       q.pop();       for (auto i : vr[cur]) {         if (!used[i]) {           used[i] = true;           mr[i] = mr[cur] + 1;           q.push(i);         }       }     }     long long mn = 0, mx = 0;     for (int i = 0; i < ps - 1; ++i) {       long long lg = 1000000000000;       set<long long> s;       for (auto j : v[p[i]]) {         if (mr[j] < lg) {           s.clear();           s.insert(j);           lg = mr[j];         } else if (mr[j] == lg) {           s.insert(j);         }       }       if (s.find(p[i + 1]) == s.end()) {         mn++;         mx++;       } else {         if (s.size() > 1) {           mx++;         }       }     }     cout << mn <<     << mx;     return 0;   }   