#include <bits/stdc++.h>
using namespace std;
int t, last[50], pre[5000], other[5000], w[50];
void add(int x, int y) {
  ++t;
  pre[t] = last[x];
  last[x] = t;
  other[t] = y;
}
int n, m, ans = 1000000, now;
int vis[50], step, num[50];
void dfs(int x) {
  step++;
  if (x == n) {
    for (int i = last[x]; i; i = pre[i])
      if (!vis[other[i]]) now += w[other[i]];
    ans = min(ans, now);
    for (int i = last[x]; i; i = pre[i])
      if (!vis[other[i]]) now -= w[other[i]];
    return;
  }
  for (int i = last[x]; i; i = pre[i])
    if (!vis[other[i]]) {
      vis[other[i]] = step;
      now += w[other[i]];
    }
  for (int i = last[x]; i; i = pre[i])
    if (vis[other[i]] == step) {
      dfs(other[i]);
    }
  for (int i = last[x]; i; i = pre[i])
    if (vis[other[i]] == step) {
      vis[other[i]] = 0;
      now -= w[other[i]];
    }
  step--;
}
int main() {
  int x, y;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  now = w[1];
  vis[1] = 1;
  dfs(1);
  cout << ans << endl;
  return 0;
}
