#include <bits/stdc++.h>
using namespace std;
long long answer = 1e9;
long long c[40];
vector<long long> g[40];
long long n, m;
vector<long long> route;
long long done[40];
long long wf[40][40];
void dfs(long long x, long long bit, long long cost) {
  if (done[x]) return;
  long long nextBit = bit;
  long long diff = 0;
  if (!(bit >> x & 1)) {
    diff += c[x];
    nextBit |= (1ll << x);
  }
  for (auto i : g[x]) {
    if (!(bit >> i & 1)) {
      nextBit |= (1ll << i);
      diff += c[i];
    }
  }
  long long nextCost = cost + diff;
  if (nextCost >= answer) {
    return;
  }
  if (x == n - 1) {
    answer = nextCost;
  }
  done[x] = 1;
  route.push_back(x);
  for (auto i : g[x]) {
    dfs(i, nextBit, nextCost);
  }
  route.pop_back();
  done[x] = 0;
}
signed main() {
  for (long long i = 0; i < 40; i++)
    for (long long j = 0; j < 40; j++) wf[i][j] = i == j ? 0 : 1e9;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(0, 0, 0);
  cout << answer << endl;
}
