#include <bits/stdc++.h>
//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using ld = long double;
using vld = vector<ld>;
using vb = vector<bool>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

template <class T> bool chmin(T& a, T b) {
    if(a > b) { a = b; return true; }
    else return false;
}

template <class T> bool chmax(T& a, T b) {
    if(a < b) { a = b; return true; }
    else return false;
}

template <class T> ostream& operator<<(ostream& s, const vector<T>& a) {
    for(auto i : a) s << i << ' ';
    return s;
}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 62;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

struct mint {
    static const long long mod = 998244353;
    long long x;
    mint(long long x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint& a) {if ((x += a.x) >= mod) x -= mod; return *this;}
    mint& operator-=(const mint& a) {if ((x += mod - a.x) >= mod) x -= mod; return *this;}
    mint& operator*=(const mint& a) {(x *= a.x) %= mod; return *this;}

    friend const mint operator+(const mint& a, const mint& b) { mint ret = a; return ret += b; }
    friend const mint operator-(const mint& a, const mint& b) { mint ret = a; return ret -= b; }
    friend const mint operator*(const mint& a, const mint& b) { mint ret = a; return ret *= b; }
    friend ostream& operator<<(ostream& s, const mint& a) { return s << a.x; }

    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2);}
    mint& operator/=(const mint a) { return (*this) *= a.inv();}
    friend const mint operator/(const mint& a, const mint& b) { mint ret = a; return ret /= b; }
};

struct combi {
    const static long long mod = mint::mod;
    int n;
    vector<mint> fac, finv, inv;
    
    combi(int _n) : n(_n + 1), fac(n, 1), finv(n, 1), inv(n, 1) {
        for (int i = 2; i < n; ++i) {
            fac[i] = fac[i - 1] * i;
            inv[i] =- inv[mod % i] * (mod / i);
            finv[i] = finv[i - 1] * inv[i];
        }
    };

    mint get(int n, int k) {
        if(n < k) return 0;
        if(n < 0 || k < 0) return 0;
        mint ret = fac[n] * finv[k] * finv[n - k];
        return ret;
    }
};

// 素因数分解
// nの(素因数、指数)のペアを返す。計算量はO(√nlogn)
vector<pair<ll, ll>> prime_factorize(ll n) {
    vector<pair<ll, ll>> ret;
    for(ll i = 2; i*i <= n; ++i) {
        if(n % i != 0) continue;
        ll ex = 0;
        while(n % i == 0) {
            ++ex;
            n /= i;
        }
        ret.push_back({i, ex});
    }
    if(n > 1) ret.push_back({n, 1});
    return ret;
}

void solve() {
    ll n, m;
    cin >> n >> m;
    mint ans = 0;
    combi com(n+100);
    for(ll i = 1; i <= m; ++i) {
        vpll vp = prime_factorize(i);
        mint ans_ = 1;
        for(auto [p, e] : vp) ans_ *= com.get(n-1+e, e);
        ans += ans_;
    }
    cout << ans << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)
#define FORI(i, n) for(int (i)=n-1; (i)>=0; (i)--)
template<class T, class U> void umin(T& x, const U& y){ x = min(x, (T)y);}
template<class T, class U> void umax(T& x, const U& y){ x = max(x, (T)y);}
template<class T, class U> void init(vector<T> &v, U x, size_t n) { v=vector<T>(n, (T)x); }
template<class T, class U, typename... W> void init(vector<T> &v, U x, size_t n, W... m) { v=vector<T>(n);  for(auto& a : v) init(a, x, m...); }

int n, m, k;
vector<vector<int>> edges;
vector<int> c;
vector<int> vis;
vector<int> d;

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(15);
    if (argc == 2 && atoi(argv[1]) == 123456789) freopen("d:\\code\\cpp\\contests\\stdin", "r", stdin);
    cin >> n >> m;
    edges.resize(n+1);
    FOR(i, m){
        int u, v;
        cin >> u >> v;
        edges[u].push_back(v);
        edges[v].push_back(u);
    }
    cin >> k;
    c.resize(k);
    FOR(i, k) cin >> c[i];

    vector<vector<int>> dist(k, vector<int>(k));
    for (int i = 0; i < k; i++){
        vector<int> d(n+1, -1);
        d[c[i]] = 0;
        queue<int> Q;
        Q.push(c[i]);
        while (!Q.empty()){
            int v = Q.front();
            Q.pop();
            for (int w : edges[v]){
                if (d[w] == -1){
                    d[w] = d[v] + 1;
                    Q.push(w);
                }
            }
        }
        for (int j = 0; j < k; j++){
            dist[i][j] = d[c[j]];
        }
    }

    int K = 1<<k;
    const int inf = 1e9;
    vector<vector<int>> dp(1 << k, vector<int>(k, inf));
    for (int i = 0; i < k; i++){
        dp[1 << i][i] = 0;
    }
    for (int i = 1; i < (1 << k); i++){
        for (int j = 0; j < k; j++){
            if (dp[i][j] != inf){
                for (int k2 = 0; k2 < k; k2++){
                    if (!(i >> k2 & 1)){
                        if (dist[j][k2] != -1){
                            int i2 = i + (1 << k2);
                            dp[i2][k2] = min(dp[i2][k2], dp[i][j] + dist[j][k2]);
                        }
                    }
                }
            }
        }
    }
    int sol = inf;
    FOR(i, k) umin(sol, dp[K-1][i]);
    cout << (sol < inf ? sol+1 : -1) << endl;

    if (argc == 2 && atoi(argv[1]) == 123456789) cout << clock()*1.0/CLOCKS_PER_SEC << " sec\n";
    return 0;
}

