#include<bits/stdc++.h>
using namespace std;
int main()
{
	freopen("traverse.in","r",stdin);
	freopen("traverse.out","w",stdout);
	int n,k,ai,bi,pd=1;
	cin>>n>>k;
	for(int i=1;i<n;i++)
	{
		cin>>ai>>bi;
		if(bi!=ai+1) pd=0;
	}
	if(pd) 
	{
		int ans=0;
		for(int i=1;i<=k;i++)
		{
			cin>>ai;
			if(ai==1||ai==n-1) ans++;
			else ans+=2;
		}
		printf("%d",ans);
	}
	else cout<<0;
 } 
