#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;

int n,m,s,t,f;
int used[200000];
int u[200000];
vector<int> g[200000];
queue<int> q;

void bfs(int fr)
{
    u[fr]=1;
    q.push(fr);
    int cr, nw;
    while(!q.empty())
    {
        cr=q.front(); q.pop();
        if(cr==f) return;
        //cout << cr << ' ' << used[cr] << endl;
        for(int i=0; i<g[cr].size(); i++)
        {
            nw=g[cr][i];
            if(u[nw]>=2) continue;
            if(used[cr]-t>=used[nw]){
                used[nw]=used[cr]+1;
                q.push(nw);
            }
        }
    }
}

int main()
{
    scanf("%d%d%d%d%d", &n, &m, &s, &t, &f);
    int x,y;
    for(int i=0; i<m; i++)
    {
        scanf("%d%d", &x, &y);
        g[x].push_back(y);
        g[y].push_back(x);
    }

    int a;
    for(int i=t; i>=1; i--)
    {
        scanf("%d", &a);
        used[a]=i;
    }
    used[s]=t+1;

    bfs(s);

    if(used[f]==0) printf("NO\n");
    else printf("%d\n", used[f]-t-1);
}
/*
13 15 9 3 1
1 2
1 3
2 4
3 4
4 5
4 6
6 7
7 9
9 8
8 6
7 12
7 13
9 10
9 11
10 11
8 6 4
*/
