#include <bits/stdc++.h>
using namespace std;
vector<int> G[50];
int w[50], best, cnt[50], vis[50], n, b[50];
void dfs(int u, int pw) {
  if (pw >= best || pw > b[u]) return;
  b[u] = min(b[u], pw);
  int tem = 0;
  vis[u] = 1;
  if (!cnt[u]) tem += w[u];
  cnt[u]++;
  for (int i = 0; i < G[u].size(); i++) {
    if (!cnt[G[u][i]]) tem += w[G[u][i]];
    cnt[G[u][i]]++;
  }
  if (u == n) {
    best = min(pw + tem, best);
    goto x;
  }
  for (int i = 0; i < G[u].size(); i++) {
    if (!vis[G[u][i]]) {
      vis[G[u][i]] = 1;
      dfs(G[u][i], pw + tem);
      vis[G[u][i]] = 0;
    }
  }
x:
  for (int i = 0; i < G[u].size(); i++) cnt[G[u][i]]--;
  cnt[u]--;
}
int main() {
  int m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 0, u, v; i < m; i++) {
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  best = 0x3f3f3f3f;
  memset(b, 0x3f, sizeof b);
  dfs(1, 0);
  printf("%d\n", best);
}
