#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin >> N >> M; vector A(N); for(auto &a : A) cin >> a; long long mod = 998244353; vector> Graph(N); for(int i=0; i> u >> v; u--; v--; Graph.at(u).push_back(v); Graph.at(v).push_back(u); } vector visited(N); long long answer = 1; for(int i=0; i Q; Q.push(i); while(Q.size()){ int pos = Q.front(); Q.pop(); now += A.at(pos); siz++; for(auto to : Graph.at(pos)){ if(visited.at(to)) continue; visited.at(to) = true; Q.push(to); } } for(int k=0; k