import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void log(A...)(A arg) {
    stderr.writeln(arg);
}
int size(T)(in T s) {
    return cast(int)s.length;
}

// graph for bridge finding
class Edge {
    int from, to;
    bool isBridge;
    this(int from, int to) {
        this.from = from;
        this.to = to;
    }
    override string toString() {
        return [from, to, isBridge].to!string;
    }
}
class Graph {
    Edge[][] G;
    int V;
    this(int V) {
        this.V = V;
        G = new Edge[][V];
    }
    void addEdge(int from, int to) {
        G[from] ~= new Edge(from, to);
        G[to] ~= new Edge(to, from);
    }
    void findBridges() {
        auto dfs_order = new int[V];
        auto lowlink = new int[V];
        dfs_order[] = -1;
        int c = 0;
        Tuple!(int, int)[] bridges;
        void dfs(int v, int prev) {
            dfs_order[v] = c++;
            lowlink[v] = dfs_order[v];
            foreach (e; G[v]) {
                auto next = e.to;
                if (next == prev) continue;
                if (dfs_order[next] >= 0) { 
                    // already visited. this 'e' is backedge.
                    lowlink[v] = min(lowlink[v], dfs_order[next]);
                } else {
                    dfs(next, v);
                    lowlink[v] = min(lowlink[v], lowlink[next]);
                }
                e.isBridge = dfs_order[v] < lowlink[next];
            }
        }
        dfs(0, -1);
    }
}

void main() {
    int N, M; scanf("%d %d\n", &N, &M);
    auto W = readln.chomp.split(" ").map!(to!int).array;
    auto graph = new Graph(N);
    foreach (i; 0 .. M) {
        int u, v; scanf("%d %d\n", &u, &v); u--; v--;
        graph.addEdge(u, v);
    }
    graph.findBridges();

    const int INF = 1<<28;
    auto g = graph.G;
    auto visited = new bool[N];
    int dfs(int v, int prev) {
        visited[v] = true;
        int ans = W[v];
        int bridge_max = 0;
        foreach (e; g[v]) {
            if (e.to == prev) continue;
            if (visited[e.to]) continue;
            auto w = dfs(e.to, v);
            if (e.isBridge) {
                bridge_max = max(bridge_max, w);
            } else {
                ans += w;
            }
        }
        return ans + bridge_max;
    }
    writeln(dfs(0, -1));
}