#include <bits/stdc++.h>
using namespace std;
int n, m;
int c[52];
bool g[52][52];
long long mask[52];
int calc(long long m) {
  int ret = 0;
  for (int i = 0; i < (int)(n); i++)
    if ((m >> i) & 1) ret += c[i];
  return ret;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (int)(n); i++) scanf("%d", c + i);
  for (int i = 0; i < (int)(m); i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    --u;
    --v;
    g[u][v] = g[v][u] = true;
  }
  for (int i = 0; i < (int)(n); i++) {
    long long m = 1ll << i;
    for (int j = 0; j < (int)(n); j++)
      if (g[i][j]) m = m | (1ll << j);
    mask[i] = m;
  }
  set<pair<long long, long long> > visited;
  stack<pair<long long, long long> > S;
  S.push(pair<long long, long long>(mask[0], 0));
  visited.insert(pair<long long, long long>(mask[0], 0));
  int ans = 1e9;
  while (S.size()) {
    pair<long long, long long> P = S.top();
    S.pop();
    long long m = P.first;
    int pos = P.second;
    for (int to = 0; to < (int)(n); to++)
      if (g[pos][to]) {
        long long nm = m | mask[to];
        if (to == n - 1) {
          ans = min(ans, calc(nm));
          continue;
        }
        pair<long long, long long> np = pair<long long, long long>(nm, to);
        if (visited.count(np)) continue;
        visited.insert(np);
        S.push(np);
      }
  }
  printf("%d\n", ans);
  return 0;
}
