/*
TASK:trip
LANG:C++
*/
#include<stdio.h>
//#define max(a,b) (a>b?a:b)

//FILE *f=fopen("trip.in","rt");
//selsko reshenie
//mnogo selsko
//ama taka e, kato ne moga da pisha svyrzani spisyci..."sysedi[1001][1001]"
//char masiv[1002][1002];
bool notold[1010];
int grr,n,m,k,x,y,a,b,maximum,queue[1010],begin,end,index[1010],sysedi[1010][1010],special;

void input()
{
//fscanf(f,"%d%d%d",&n,&m,&k);
scanf("%d%d%d",&n,&m,&k);
/*
for(x=0;x<n;x++)
for(y=0;y<n;y++)
masiv[x][y]='0';
*/
for(x=0;x<m;x++)
                {
                //fscanf(f,"%d%d",&a,&b);
                scanf("%d%d",&a,&b);
                a--;
                b--;
                //masiv[a][b]='1';
                //masiv[b][a]='1';
                sysedi[a][index[a]++]=b;
                sysedi[b][index[b]++]=a;
                }
for(x=0;x<n;x++)
notold[x]=1;
for(x=0;x<k;x++)
                {
                //fscanf(f,"%d",&a);
                scanf("%d",&a);
                notold[a-1]=0;
                }
maximum=0;
return;
}

int flood_bfs(int x)
{
special=0;
if(notold[x]==0)
{
notold[x]=1;
special=1;
}

bool used[1010]={0},queued[1010]={0};
int way[1010]={0},stypki[1010];
for(y=0;y<n;y++)stypki[y]=1024;
begin=0;
end=1;
queue[0]=x;
stypki[x]=0;
while(begin!=end)
{
used[queue[begin]]=1;
way[queue[begin]]+=notold[queue[begin]];
for(y=0;y<index[queue[begin]];y++)
if(!used[sysedi[queue[begin]][y]]&&stypki[queue[begin]]<stypki[sysedi[queue[begin]][y]]&&way[queue[begin]]>way[sysedi[queue[begin]][y]])
{
way[sysedi[queue[begin]][y]]=way[queue[begin]];
if(!queued[sysedi[queue[begin]][y]])
{
queue[end++]=sysedi[queue[begin]][y];
queued[sysedi[queue[begin]][y]]=1;
}
stypki[sysedi[queue[begin]][y]]=stypki[queue[begin]]+1;
}
begin++;
}
begin=0;
for(y=0;y<n;y++)
if(way[y]>begin&&way[y]>0)
begin=way[y];

if(special==1)
{
notold[x]=0;
begin--;
}

return begin;
}





int main()
{
input();
for(x=0;x<n;x++)
{
grr=flood_bfs(x);
if(grr>maximum)
maximum=grr;
}
printf("%d\n",maximum);
return 0;
}

