func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mxn = 2e5;   const long long INF = 2e18;   const int32_t M = 1000000007;   const long double pie = acos(-1);   template <typename Arg1>   void __f(const char *name, Arg1 &&arg1) {     cerr << name <<   :   << arg1 << std::endl;   }   template <typename Arg1, typename... Args>   void __f(const char *names, Arg1 &&arg1, Args &&...args) {     const char *comma = strchr(names + 1,  , );     cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   void solve() {     long long n, m;     cin >> n >> m;     vector<long long> gr[n + 1];     vector<long long> ingr[n + 1];     for (long long i = 1; i <= m; i++) {       long long u, v;       cin >> u >> v;       gr[u].push_back(v);       ingr[v].push_back(u);     }     long long k;     cin >> k;     vector<long long> p(k + 1);     for (long long i = 1; i <= k; i++) {       cin >> p[i];     }     long long s = p[1], t = p[k];     vector<long long> d(n + 1, INF);     d[t] = 0;     queue<long long> q;     vector<bool> vis(n + 1, false);     q.push(t);     vis[t] = true;     while (!q.empty()) {       long long v = q.front();       q.pop();       for (long long u : ingr[v]) {         if (!vis[u]) {           q.push(u);           vis[u] = true;         }         d[u] = min(d[u], d[v] + 1);       }     }     long long mn = 0, mx = 0;     for (long long i = 1; i <= k - 1; i++) {       long long curmn = INF;       for (long long v : gr[p[i]]) {         curmn = min(curmn, d[v]);       }       long long cntmn = 0;       for (long long v : gr[p[i]]) {         if (d[v] == curmn) cntmn++;         if (cntmn == 2) break;       }       if (d[p[i + 1]] == curmn) {         if (cntmn == 2) mx++;       } else {         mx++;         mn++;       }     }     cout << mn <<     << mx;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long _t = 1;     for (long long i = 1; i <= _t; i++) {       solve();     }     return 0;   }   