#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int n, m;
int first[55], tot;
struct Edge {
  int y, nex;
} edge[100000];
void addedge(int x, int y) {
  edge[tot] = (Edge){y, first[x]};
  first[x] = tot++;
}
int val[100];
long long mask1[100];
int bo[55];
long long getMask(int x) {
  long long ans = mask1[x];
  bo[x]++;
  if (x == n - 1) return ans;
  for (int k = first[x]; k != -1; k = edge[k].nex) {
    int y = edge[k].y;
    if (bo[y]) continue;
    long long q = getMask(y);
    if (q != -1) {
      return ans | q;
    }
  }
  return -1;
}
int ans = 0;
int getVal(long long x) {
  int res = 0;
  for (int i = 0; i < n; ++i)
    if (x >> i & 1) res += val[i];
  return res;
}
void dfs(int x, long long mask, int res, int dep) {
  if (res >= ans) return;
  if (x == n - 1) {
    ans = min(ans, res);
    return;
  }
  for (int k = first[x]; k != -1; k = edge[k].nex) {
    int y = edge[k].y;
    if (bo[y]) continue;
    ++bo[y];
    dfs(y, mask1[y] | mask, getVal(mask1[y] | mask), dep + 1);
    --bo[y];
  }
}
int main() {
  srand(time(0));
  scanf("%d%d", &n, &m);
  memset(first, -1, sizeof(first));
  for (int i = 0; i < n; ++i) {
    scanf("%d", &val[i]);
    mask1[i] = 1LL << i;
  }
  tot = 0;
  for (int i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x;
    --y;
    addedge(x, y);
    addedge(y, x);
    mask1[x] |= 1LL << y;
    mask1[y] |= 1LL << x;
  }
  memset(bo, 0, sizeof(bo));
  ans = 1 << 30;
  bo[0] = 1;
  dfs(0, mask1[0], getVal(mask1[0]), 1);
  cout << ans << endl;
  return 0;
}
