# 【xdoj难题集】1116 Dominator Orz Pandas

# include <stdio.h>
# include <string.h>
# include <vector>

using namespace std;

typedef long long ll;

const int MAX_N = 1e5 + 5;
const int Mod = 1e9 + 7;

bool used[MAX_N];

vector<int> G[MAX_N];
int d[MAX_N];

ll jie[MAX_N + 1], ni[MAX_N + 1];
int N, M;

int dfs(int prv , int x)
{
int ans = 1, i;
for(i = 0 ; i < G[x].size() ; i++)
{
int t = G[x][i];
if(t == prv)
continue;

ans += dfs(x , t);
}

return d[x] = ans;
}

void solve()
{
dfs(-1 , 0);
ll ans = jie[N];
//printf("haha%d\n", d[0]);
memset(used , 0 , sizeof(used));

int i, c;
for(i = 0 ; i < M ; i++)
{
scanf("%d", &c);
c--;
if(!used[c])
{
used[c] = 1;
ans = ans * ni[d[c]] % Mod;
}
}

printf("%lld\n", ans);
}

int main()
{
jie[0] = jie[1] = 1;
ni[0] = ni[1] = 1;

int i;
for(i = 2 ; i <= MAX_N ; i++)
jie[i] = jie[i - 1] * i % Mod;

for(i = 2 ; i <= MAX_N ; i++)
ni[i] = ni[Mod % i] * (Mod - Mod / i) % Mod;

//printf("%lld\n", 19261 * ni[19261] % Mod);

while(~scanf("%d %d", &N, &M))
{
int i, t, s;
for(i = 0 ; i < N - 1 ; i++)
{
scanf("%d %d", &t, &s);
t--;
s--;
G[t].push_back(s);
G[s].push_back(t);
}

solve();

for(i = 0 ; i < N ; i++)
G[i].clear();
}

return 0;
}