#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define REP(i,n) for (int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define read(x) scanf("%d",&x)
int n,m;
int c[45];
vector<int> E[45];
int ans=1e9;
inline void dfs(int v,ll seen,int cost){
	ll nseen=seen;int ncost=cost;
	if (!(nseen&(1ll<<v))){
		nseen|=1ll<<v;
		ncost+=c[v];
	}
	for (int i=0;i<E[v].size();++i){
		int u=E[v][i];
		if (!(nseen&(1ll<<u))){
			ncost+=c[u];
			nseen|=1ll<<u;
		}
	}
	if (ncost>=ans) return;
	if (v==n){
		ans=ncost;return;
	}
	for (int i=0;i<E[v].size();++i){
		int u=E[v][i];
		if (!(seen&(1ll<<u))) dfs(u,nseen,ncost);
	}
	
}
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for (int i=1;i<=n;++i) cin>>c[i];
	for (int i=1;i<=m;++i){
		int x,y;
		cin>>x>>y;
		E[x].pb(y);E[y].pb(x);
	}
	dfs(1,0,0);
	cout<<ans<<endl;
	return 0;
}
