#include <bits/stdc++.h>
using namespace std;
const int N = 44;
const int INF = 1e9 + 7;
int n, m, cost[N];
vector<int> adj[N];
int ban[N], neigh[N], visit[N];
int ans = INF;
void dfs(int s, int mask) {
  if (s == n - 1) {
    int cur = 0;
    for (int i = 0; i < n; i++) {
      if (mask >> i & 1) {
        cur += cost[i];
      }
    }
    ans = min(ans, cur);
    return;
  }
  ban[s]++;
  for (int i = 0; i < adj[s].size(); i++) {
    int t = adj[s][i];
    ban[t]++;
  }
  for (int i = 0; i < adj[s].size(); i++) {
    int t = adj[s][i];
    if (ban[t] > 1) continue;
    dfs(t, mask | neigh[t]);
  }
  ban[s]--;
  for (int i = 0; i < adj[s].size(); i++) {
    int t = adj[s][i];
    ban[t]--;
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &cost[i]);
    neigh[i] = (1 << i);
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--, v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
    neigh[u] |= (1 << v);
    neigh[v] |= (1 << u);
  }
  dfs(0, neigh[0]);
  printf("%d\n", ans);
  return 0;
}
