#include <bits/stdc++.h>
using namespace std;
const int MAXN = 44;
int n, m;
int w[MAXN];
vector<int> arr[MAXN];
int ans = 0;
bool mark[MAXN], vis[MAXN];
void dfs(int u, int cnt) {
  if (u == n) {
    for (int i = 0; i < arr[u].size(); i++) {
      int v = arr[u][i];
      if (!mark[v]) {
        cnt += w[v];
      }
    }
    ans = min(ans, cnt);
    return;
  }
  if (cnt >= ans) return;
  if (vis[u]) return;
  vector<int> add;
  int tmpAdd = 0;
  if (!mark[u]) {
    mark[u] = true;
    add.push_back(u);
    tmpAdd += w[u];
  }
  for (int i = 0; i < arr[u].size(); i++) {
    int v = arr[u][i];
    if (!mark[v]) {
      mark[v] = true;
      add.push_back(v);
      tmpAdd += w[v];
    }
  }
  if (cnt + tmpAdd >= ans) return;
  vis[u] = true;
  for (int i = 0; i < arr[u].size(); i++) {
    int v = arr[u][i];
    if (vis[v]) continue;
    dfs(v, cnt + tmpAdd);
  }
  vis[u] = false;
  for (int i = 0; i < add.size(); i++) {
    mark[add[i]] = false;
  }
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    ans = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &w[i]);
      mark[i] = false;
      vis[i] = false;
      arr[i].clear();
      ans += w[i];
    }
    while (m--) {
      int x, y;
      scanf("%d%d", &x, &y);
      arr[x].push_back(y);
      arr[y].push_back(x);
    }
    dfs(1, 0);
    printf("%d\n", ans);
  }
  return 0;
}
