#include <bits/stdc++.h>

#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define sz(s) (int)s.size()
#define all(x) x.bg, x.en
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define rbg rbegin()
#define bg begin()
#define en end()
#define s second
#define f first

using namespace std;

typedef pair < long long, long long > pll;
typedef pair < int, int > pii;
typedef unsigned long long ull;
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;
typedef long long ll;
typedef double db;

const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 265;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, N = 1e5 + 11, mod = 1e9 + 7;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;

int n, v, u, a[N], Sz[N], curSz, ans, dp[2][20], av;
bool was[N];
vi g[N];

void dfs (int v, int p = 0) {
	Sz[v] = 1;
	for (auto to : g[v]) {
		if (was[to] || to == p)
			continue;
		dfs(to, v);
		Sz[v] += Sz[to];
	}
}

void add (int d) {
	forn (i, 0, 19)
		++dp[(d >> i) & 1][i];
}

void dfs1 (int v, int p = 0, int d = 0) {
	d ^= a[v];
	ans += d ^ av;
	forn (i, 0, 19)
		ans += (dp[((d >> i) & 1) ^ 1][i] << i);
	for (auto to : g[v]) {
		if (was[to] || to == p)
			continue;
		dfs1(to, v, d);
	}
}

void dfs2 (int v, int p = 0, int d = av) {
	d ^= a[v];
	add(d);
	for (auto to : g[v]) {
		if (was[to] || to == p)
			continue;
		dfs2(to, v, d);
	}
}

int Find (int v) {
	for (auto to : g[v]) {
		if (was[to] || Sz[to] > Sz[v])
			continue;
		if (Sz[to] * 2 > curSz)
			return Find(to);
	}
	return v;
}

void calc (int v) {
	dfs(v);
	curSz = Sz[v];
	memset(dp, 0, sizeof(dp));
	v = Find(v);
	was[v] = 1;
	ans += a[v];
	av = a[v];
	for (auto to : g[v]) {
		if (was[to])
			continue;
		dfs1(to);
		dfs2(to);
	}
	for (auto to : g[v])
		if (!was[to])
			calc(to);
}

main () {
//	file("");
	cin >> n;
	forn (i, 1, n)
		cin >> a[i];

	forn (i, 2, n) {
		cin >> v >> u;
		g[v].pb(u);
		g[u].pb(v);
	}
	calc(1);
	cout << ans << endl;
	return 0;
}


#include <bits/stdc++.h>

//#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define sz(s) (int)s.size()
#define all(x) x.bg, x.en
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define rbg rbegin()
#define bg begin()
#define en end()
#define s second
#define f first

using namespace std;

typedef pair < long long, long long > pll;
typedef pair < int, int > pii;
typedef unsigned long long ull;
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;
typedef long long ll;
typedef double db;

const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 265;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, N = 1e5 + 11, mod = 1e9 + 7;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;

int n, v, u, a[N], Sz[N], curSz, dp[2][20], av;
ll ans;
bool was[N];
vi g[N];

void dfs (int v, int p = 0) {
	Sz[v] = 1;
	for (auto to : g[v]) {
		if (was[to] || to == p)
			continue;
		dfs(to, v);
		Sz[v] += Sz[to];
	}
}

void add (int d) {
	forn (i, 0, 19)
		++dp[(d >> i) & 1][i];
}

void dfs1 (int v, int p = 0, int d = 0) {
	d ^= a[v];
	ans += d ^ av;
	forn (i, 0, 19)
		ans += (dp[((d >> i) & 1) ^ 1][i]) * (1LL << i);
	for (auto to : g[v]) {
		if (was[to] || to == p)
			continue;
		dfs1(to, v, d);
	}
}

void dfs2 (int v, int p = 0, int d = av) {
	d ^= a[v];
	add(d);
	for (auto to : g[v]) {
		if (was[to] || to == p)
			continue;
		dfs2(to, v, d);
	}
}

int Find (int v) {
	for (auto to : g[v]) {
		if (was[to] || Sz[to] > Sz[v])
			continue;
		if (Sz[to] * 2 > curSz)
			return Find(to);
	}
	return v;
}

void calc (int v) {
	dfs(v);
	curSz = Sz[v];
	memset(dp, 0, sizeof(dp));
	v = Find(v);
	was[v] = 1;
	ans += a[v];
	av = a[v];
	for (auto to : g[v]) {
		if (was[to])
			continue;
		dfs1(to);
		dfs2(to);
	}
	for (auto to : g[v])
		if (!was[to])
			calc(to);
}

main () {
//	file("");
	scanf("%d", &n);
	forn (i, 1, n)
		scanf("%d", &a[i]);

	forn (i, 2, n) {
		scanf("%d%d", &v, &u);
		g[v].pb(u);
		g[u].pb(v);
	}
	calc(1);
	printf("%lld\n", ans);
	return 0;
}


#define PRON "766e"
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;

const int maxn = 1e5 + 10;
const int maxa = 1e6 + 10;

vector<int> g[maxn];
int n, sum, ans = 0, a[maxn], dig[maxn], cnt[maxn][2];

void dfs(int u, int fa){
	cnt[u][dig[u]] ++;

	for (int i = 0, v; i < g[u].size(); i ++){
		v = g[u][i];

		if (v == fa)
			continue;

		dfs(v, u);
		sum += cnt[u][1] * cnt[v][0] + cnt[u][0] * cnt[v][1];
		cnt[u][dig[u]] += cnt[v][0];
		cnt[u][dig[u] ^ 1] += cnt[v][1];
	}
}

int main(){
#ifndef ONLINE_JUDGE
	freopen(PRON ".in", "r", stdin);
#endif

	scanf("%d", &n);
	for (int i = 1; i <= n; i ++){
		scanf("%d", &a[i]);
		ans += a[i];
	}

	for (int i = 0, u, v; i < n - 1; i ++){
		scanf("%d %d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}

	for (int i = 1; i <= maxa; i <<= 1){
		for (int j = 1; j <= n; j ++)
			dig[j] = !!(i & a[j]);

		memset(cnt, 0, sizeof cnt);
		sum = 0;

		dfs(1, 0);

		ans += sum * i;
	}

	printf("%d\n", ans);
}


#define PRON "766e"
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

const int maxn = 1e6 + 10;

int n, maxa = 0, a[maxn];
vector<int> g[maxn];
ll ans = 0, sum, dig[maxn], cnt[maxn][2];

void dfs(int u, int fa){
	cnt[u][dig[u]] = 1;

	for (int i = 0, v; i < g[u].size(); i ++){
		v = g[u][i];

		if (v == fa)
			continue;

		dfs(v, u);
		sum += cnt[u][1] * cnt[v][0] + cnt[u][0] * cnt[v][1];

		cnt[u][dig[u]] += cnt[v][0];
		cnt[u][dig[u] ^ 1] += cnt[v][1];
	}
}

int main(){
#ifndef ONLINE_JUDGE
	freopen(PRON ".in", "r", stdin);
#endif

	scanf("%d", &n);
	for (int i = 1; i <= n; i ++){
		scanf("%d", &a[i]);
		ans += (ll)a[i];
		maxa = max(a[i], maxa);
	}

	for (int i = 0, u, v; i < n - 1; i ++){
		scanf("%d %d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}

	for (int i = 1; i <= maxa * 2; i <<= 1){
		for (int j = 1; j <= n; j ++)
			dig[j] = !!(i & a[j]);

		memset(cnt, 0, sizeof cnt);
		sum = 0;

		dfs(1, 0);

		ans += sum * (ll)i;
	}

	cout << ans << endl;
}


#define PRON "766e"
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;

const int maxn = 1e5 + 10;

ll ans = 0;
vector<int> g[maxn];
int n, sum, maxa = 0, a[maxn], dig[maxn], cnt[maxn][2];

void dfs(int u, int fa){
	cnt[u][dig[u]] ++;

	for (int i = 0, v; i < g[u].size(); i ++){
		v = g[u][i];

		if (v == fa)
			continue;

		dfs(v, u);
		sum += cnt[u][1] * cnt[v][0] + cnt[u][0] * cnt[v][1];
		cnt[u][dig[u]] += cnt[v][0];
		cnt[u][dig[u] ^ 1] += cnt[v][1];
	}
}

int main(){
#ifndef ONLINE_JUDGE
	freopen(PRON ".in", "r", stdin);
#endif

	scanf("%d", &n);
	for (int i = 1; i <= n; i ++){
		scanf("%d", &a[i]);
		ans += (ll)a[i];
		maxa = max(a[i], maxa);
	}

	for (int i = 0, u, v; i < n - 1; i ++){
		scanf("%d %d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}

	for (int i = 1; i <= maxa; i <<= 1){
		for (int j = 1; j <= n; j ++)
			dig[j] = !!(i & a[j]);

		memset(cnt, 0, sizeof cnt);
		sum = 0;

		dfs(1, 0);

		ans += (ll)sum * (ll)i;
	}

	printf("I64d%\n", ans);
}


#define PRON "766e"
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;

const int maxn = 1e5 + 10;

ll ans = 0;
vector<int> g[maxn];
int n, sum, maxa = 0, a[maxn], dig[maxn], cnt[maxn][2];

void dfs(int u, int fa){
	cnt[u][dig[u]] ++;

	for (int i = 0, v; i < g[u].size(); i ++){
		v = g[u][i];

		if (v == fa)
			continue;

		dfs(v, u);
		sum += cnt[u][1] * cnt[v][0] + cnt[u][0] * cnt[v][1];
		cnt[u][dig[u]] += cnt[v][0];
		cnt[u][dig[u] ^ 1] += cnt[v][1];
	}
}

int main(){
#ifndef ONLINE_JUDGE
	freopen(PRON ".in", "r", stdin);
#endif

	scanf("%d", &n);
	for (int i = 1; i <= n; i ++){
		scanf("%d", &a[i]);
		ans += (ll)a[i];
		maxa = max(a[i], maxa);
	}

	for (int i = 0, u, v; i < n - 1; i ++){
		scanf("%d %d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}

	for (int i = 1; i <= maxa; i <<= 1){
		for (int j = 1; j <= n; j ++)
			dig[j] = !!(i & a[j]);

		memset(cnt, 0, sizeof cnt);
		sum = 0;

		dfs(1, 0);

		ans += (ll)sum * (ll)i;
	}

	printf("%I64d\n", ans);
}


#define PRON "766e"
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

const int maxn = 1e6 + 10;

ll ans = 0;
vector<int> g[maxn];
int n, sum, maxa = 0, a[maxn], dig[maxn], cnt[maxn][2];

void dfs(int u, int fa){
	cnt[u][dig[u]] ++;

	for (int i = 0, v; i < g[u].size(); i ++){
		v = g[u][i];

		if (v == fa)
			continue;

		dfs(v, u);
		sum += cnt[u][1] * cnt[v][0] + cnt[u][0] * cnt[v][1];
		cnt[u][dig[u]] += cnt[v][0];
		cnt[u][dig[u] ^ 1] += cnt[v][1];
	}
}

int main(){
#ifndef ONLINE_JUDGE
	freopen(PRON ".in", "r", stdin);
#endif

	scanf("%d", &n);
	for (int i = 1; i <= n; i ++){
		scanf("%d", &a[i]);
		ans += (ll)a[i];
		maxa = max(a[i], maxa);
	}

	for (int i = 0, u, v; i < n - 1; i ++){
		scanf("%d %d", &u, &v);
		g[u].push_back(v);
		g[v].push_back(u);
	}

	for (int i = 1; i <= maxa; i <<= 1){
		for (int j = 1; j <= n; j ++)
			dig[j] = !!(i & a[j]);

		memset(cnt, 0, sizeof cnt);
		sum = 0;

		dfs(1, 0);

		ans += (ll)sum * (ll)i;
	}

	cout << ans;
}


#include <bits/stdc++.h>
#define N 100000

using namespace std;

long long b[N+9];
vector<int> a[N+9];
long long val[N+9][2];
int k;
long long ans;

void dfs(int u,int prev,int k)
{
    //printf("%d\n",k);
    int d=((b[u]>>k)&1);
    val[u][d]++;
    for(auto v:a[u])
    {
        if(v!=prev)
        {
            dfs(v,u,k);
            ans+=1ll*val[u][d]*val[v][d^1]*(1ll<<k);
            val[u][0]+=val[v][d];
            val[u][1]+=val[v][d^1];
        }
    }
    //printf("(%d %lld %lld)\n",u,val[u][0],val[u][1]);

}

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&b[i]);
        ans+=b[i];
    }
    for(int i=1;i<n;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        a[x].push_back(y);
        a[y].push_back(x);
    }
    for(k=19;k>=0;k--)
    {
        dfs(1,-1,k);
        //printf("%d\n",k);
        for(int j=1;j<=n;j++)
        {
            val[j][0]=val[j][1]=0;
        }
    }
    printf("%lld",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

//#define PB push_back
#define PB emplace_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define pf printf
#define sf scanf
#define left __left
#define right __right

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)

#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

inline bool checkBit(ll n, int i) { return n&(1LL<<i); }
inline ll setBit(ll n, int i) { return n|(1LL<<i);; }
inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); }

int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
//int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
//int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

/*
bool seive[1010000];
vi prime;

void seiveGen(int limit) {
    limit += 100;
    int sqrtn = sqrt(limit);
    for(int i = 3; i <= sqrtn; i += 2) {
            if(!seive[i>>1]) {
                    for(int j = i * i; j < limit; j += i + i) {
                            seive[j>>1] = 1;
                    }
            }
    }
    prime.PB(2);
    for(int i = 3; i < limit; i += 2) {
            if(!seive[i>>1]) prime.PB(i);
    }
}
*/

inline ll power(ll bs,ll k)
{
    ll x = 1LL,y = bs;
    if(k == 0) return 1LL;

    while(k > 0){
        if(k % 2) x *= y;

        y *= y;
        k /= 2;
    }

    return x;
}

//debug
//#ifdef Pretest
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
            return os << "(" << p.first << ", " << p.second << ")";
}

template<class T>
string to_str(T t){ stringstream ss; ss << t; return ss.str();}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
            os << "{";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << *it;
                                            }
                    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
            os << "[";
                for(auto it = v.begin(); it != v.end(); ++it) {
                                if( it != v.begin() ) os << ", ";
                                        os << it -> first << " = " << it -> second ;
                                            }
                    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () {
            cerr << endl;
}

template <typename T>
void faltu( T a[], int n ) {
            for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
                cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) {
            cerr << arg << ' ';
                faltu(rest...);
}
/*#else
#define dbg(args...)
#endif //Pretest*/

#define MX 400
vvi g;
vii edges,ans;
int n,k,a[MX],m;
bool mrk[MX],vis[MX];

void dfs(int u)
{
    vis[u] = true;
    int i,j,sz = (int)g[u].size();

    for(i = 0; i < sz; ++i){
        j = g[u][i];
        if(vis[j]) continue;
        ans.PB(pii(min(u,j),max(u,j)));
        dfs(j);
    }
}

int main()
{
    optimize();
    fraction();
    int i,j;
    cin >> n >> m >> k;
    g.resize(n + 10);
    mem(mrk,false);
    mem(vis,false);
    for(i = 0 ;i < k; ++i){
        cin >> a[i];
        mrk[a[i]] = true;
    }
    sort(a,a + k);
    if(k == n){
        cout << -1;
        return 0;
    }

    for(i = 1; i <= n; ++i){
        for(j = i + 1; j <= n; ++j){
            if(i == a[0] || j == a[0] || i == a[1] || j == a[1]) continue;
            g[i].PB(j);
            g[j].PB(i);
            edges.PB(pii(min(i,j),max(i,j)));
        }
    }
    for(i = 1; i <= n; ++i){
        if(mrk[i]){
            if(i != a[0] && i != a[1]){
                g[i].PB(a[0]);
                g[a[0]].PB(i);
                edges.PB(pii(min(i,a[0]),max(i,a[0])));
            }
            continue;
        }
        g[i].PB(a[0]);
        g[a[0]].PB(i);
        g[a[1]].PB(i);
        g[i].PB(i);
        edges.PB(pii(min(i,a[0]),max(i,a[0])));
        edges.PB(pii(min(i,a[1]),max(i,a[1])));
    }
    //dbg((int)edges.size());
    if((int)edges.size() < m){
        cout << -1;
        return 0;
    }
    for(i = 1; i <= n; ++i){
        if(mrk[i]) continue;
        dfs(i);
        sort(ans.begin(),ans.end());
        break;
    }
    for(i = 0; i < (int)edges.size(); ++i){
        if(!binary_search(ans.begin(),ans.end(),edges[i]) && (int)ans.size() < m) ans.PB(edges[i]);
    }

    for(i = 0; i < m; ++i) cout << ans[i].F << ' ' << ans[i].S << endl;
    return 0;
}


// Why am I so stupid? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

typedef long long ll;

using namespace std;

vector < pair <int, int> > ans;

bool u[305];

int n, m, k;

void addEdge(int u, int v) {
    if (m > 0) {
        ans.pb(mp(u, v));
        --m;
    }
}

void solve() {
    scanf("%d %d %d", &n, &m, &k);

    if (m == n * (n - 1) / 2) {
        printf("-1\n");
        return;
    }

    if (k == n) {
        printf("-1\n");
        return;
    }

    for (int i = 1, x; i <= k; ++i) {
        scanf("%d", &x);
        u[x] = 1;
    }

    int v = -1;

    for (int i = 1; i <= n; ++i) {
        if (u[i]) {
            v = i;
        }
    }

    for (int i = 1; i <= n; ++i) {
        if (!u[i]) {
            addEdge(v, i);
        }
    }

    for (int l = 1; l <= n; ++l) {
        if (l == v) {
            continue;
        }

        for (int r = l + 1; r <= n; ++r) {
            if (r == v) {
                continue;
            }

            addEdge(l, r);
        }
    }

    if (m > 0) {
        printf("-1\n");
        return;
    }

    for (auto it : ans) {
        printf("%d %d\n", it.fi, it.se);
    }
}

int main() {
#ifdef BThero
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // BThero

    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}


// Why am I so stupid? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

typedef long long ll;

using namespace std;

bool adj[305][305];

bool u[305];

int n, m, k;

void addEdge(int u, int v) {
    if (u == v) {
        return;
    }

    if (u > v) {
        swap(u, v);
    }

    if (adj[u][v]) {
        return;
    }

    if (!adj[u][v] && m > 0) {
        adj[u][v] = 1;
        --m;
    }
}

void solve() {
    scanf("%d %d %d", &n, &m, &k);

    if (m == n * (n - 1) / 2) {
        printf("-1\n");
        return;
    }

    if (k == n) {
        printf("-1\n");
        return;
    }

    for (int i = 1, x; i <= k; ++i) {
        scanf("%d", &x);
        u[x] = 1;
    }

    int v = -1, v2;

    for (int i = 1; i <= n; ++i) {
        if (u[i]) {
            v = i;
        }
        else {
            v2 = i;
        }
    }

    addEdge(v, v2);

    for (int i = 1; i <= n; ++i) {
        addEdge(v2, i);
    }

    for (int i = 1; i <= n; ++i) {
        if (!u[i]) {
            addEdge(v, i);
        }
    }

    for (int l = 1; l <= n; ++l) {
        if (l == v) {
            continue;
        }

        for (int r = l + 1; r <= n; ++r) {
            if (r == v) {
                continue;
            }

            addEdge(l, r);
        }
    }

    if (m > 0) {
        printf("-1\n");
        return;
    }

    for (int l = 1; l <= n; ++l) {
        for (int r = l + 1; r <= n; ++r) {
            if (adj[l][r]) {
                printf("%d %d\n", l, r);
            }
        }
    }
}

int main() {
#ifdef BThero
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // BThero

    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}


// Why am I so stupid? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

typedef long long ll;

using namespace std;

bool adj[305][305];

bool u[305];

int n, m, k;

void addEdge(int u, int v) {
    if (u == v) {
        return;
    }

    if (u > v) {
        swap(u, v);
    }

    if (adj[u][v]) {
        return;
    }

    if (!adj[u][v] && m > 0) {
        adj[u][v] = 1;
        --m;
    }
}

void solve() {
    scanf("%d %d %d", &n, &m, &k);

    if (m == n * (n - 1) / 2) {
        printf("-1\n");
        return;
    }

    if (k == n) {
        printf("-1\n");
        return;
    }

    for (int i = 1, x; i <= k; ++i) {
        scanf("%d", &x);
        u[x] = 1;
    }

    int v = -1, v2;

    for (int i = 1; i <= n; ++i) {
        if (u[i]) {
            v = i;
        }
        else {
            v2 = i;
        }
    }

    addEdge(v, v2);

    for (int i = 1; i <= n; ++i) {
        addEdge(v2, i);
    }

    for (int i = 1; i <= n; ++i) {
        if (u[i]) {
            addEdge(v, i);
        }
    }

    for (int l = 1; l <= n; ++l) {
        if (l == v) {
            continue;
        }

        for (int r = l + 1; r <= n; ++r) {
            if (r == v) {
                continue;
            }

            addEdge(l, r);
        }
    }

    if (m > 0) {
        printf("-1\n");
        return;
    }

    for (int l = 1; l <= n; ++l) {
        for (int r = l + 1; r <= n; ++r) {
            if (adj[l][r]) {
                printf("%d %d\n", l, r);
            }
        }
    }
}

int main() {
#ifdef BThero
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // BThero

    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}


// Why am I so stupid? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

typedef long long ll;

using namespace std;

vector < pair <int, int> > ans;

bool u[305];

int n, m, k;

void addEdge(int u, int v) {
    if (m > 0) {
        ans.pb(mp(u, v));
        --m;
    }
}

void solve() {
    scanf("%d %d %d", &n, &m, &k);

    if (m == n * (n - 1) / 2) {
        printf("-1\n");
        return;
    }

    for (int i = 1, x; i <= k; ++i) {
        scanf("%d", &x);
        u[x] = 1;
    }

    int v = -1;

    for (int i = 1; i <= n; ++i) {
        if (!u[i]) {
            v = i;
        }
    }

    if (v == -1) {
        printf("-1\n");
        return;
    }

    for (int i = 1; i <= n; ++i) {
        if (i != v) {
            addEdge(i, v);
        }
    }

    for (int l = 1; l <= n; ++l) {
        if (l == v) {
            continue;
        }

        for (int r = l; r <= n; ++r) {
            if (r == v || r == l) {
                continue;
            }

            addEdge(l, r);
        }
    }

    for (auto it : ans) {
        printf("%d %d\n", it.fi, it.se);
    }
}

int main() {
#ifdef BThero
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // BThero

    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}


// Why am I so stupid? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

typedef long long ll;

using namespace std;

vector < pair <int, int> > ans;

bool u[305];

int n, m, k;

void addEdge(int u, int v) {
    if (m > 0) {
        ans.pb(mp(u, v));
        --m;
    }
}

void solve() {
    scanf("%d %d %d", &n, &m, &k);

    if (m == n * (n - 1) / 2) {
        printf("-1\n");
        return;
    }

    for (int i = 1, x; i <= k; ++i) {
        scanf("%d", &x);
        u[x] = 1;
    }

    int v = -1;

    for (int i = 1; i <= n; ++i) {
        if (!u[i]) {
            v = i;
        }
    }

    if (v == -1) {
        printf("-1\n");
        return;
    }

    for (int i = 1; i <= n; ++i) {
        if (i != v) {
            addEdge(i, v);
        }
    }

    for (int l = 1; l <= n; ++l) {
        if (l == v) {
            continue;
        }

        for (int r = l; r <= n; ++r) {
            if (r == v) {
                continue;
            }

            addEdge(l, r);
        }
    }

    for (auto it : ans) {
        printf("%d %d\n", it.fi, it.se);
    }
}

int main() {
#ifdef BThero
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // BThero

    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define rep(i,a,b) for(i=(a);i<=(b);++i)
#define rev(i,a,b) for(i=(a);i>=(b);--i)
#define max2(a,b)  ((a)>(b)?(a):(b))
#define min2(a,b)  ((a)<(b)?(a):(b))
#define all(x) x.begin(),x.end()
#define sz(x) (long long)x.size()
#define fi first
#define se second
#define pb emplace_back // push_back
#define mp make_pair
#define endl '\n'

#ifdef Wild4Stone
template<typename T>
void __p(T a) { cout << a << " "; }
template<typename T, typename F>
void __p(pair<T, F> a) { cout << "{ "; __p(a.fi); __p(a.se); cout << "}"; }
template<typename T>
void __f(const char* s, T t) { cout << s << " : "; __p(t); }
template<typename T>
void __t(const char* s, const T &x) { cout << s << " : { "; for (auto it : x) __p(it); cout << "} ";}
template<typename T, typename ... F>
void __f(const char* s, T t, F ... f) {
	int i = 0; for (;; ++i) if (s[i] == ',') break;
	cout.write(s, i) << " : "; __p(t); cout << " | "; __f(s + i + 1, f...);
}
#define trace(...) { cout<<"LINE: "<<__LINE__<<" || "; __f(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
#define autra(...) { cout<<"LINE: "<<__LINE__<<" || "; __t(#__VA_ARGS__,__VA_ARGS__); cout<<"\n\n"; }
#else
#define trace(...) {}
#define autra(...) {}
#endif

typedef long long int ll;
typedef pair<ll, ll> pll;

const ll mod = 1000000007;  //998244353;
const ll inf = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
const double PI = acos(-1);

ll i, j, k;
void solve(void);
inline bool equal(double a, double b) { return fabs(a - b) < eps; }
// inline ll gcd(ll a, ll b) { a=abs(a); b=abs(b); while(a>0 && b>0) (a>b?a%=b:b%=a); return (a==0?b:a); }
// inline ll power(ll x, ll n, ll m = LLONG_MAX)
//        {  ll res=1; x = (x%m + m)%m;
//             while(n) { if(n&1) res=(res*x)%m;  x=(x*x)%m;  n >>= 1; }  return res;
//        }

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	int t = 1;
	// cin>>t;
	while (t--)  solve();
	return 0;
}

//***************** Code Starts Here *******************//

void solve()
{
	int n, m, k; cin >> n >> m >> k;

	vector<int> v, t;
	bool marked[n + 1] = {0};
	rep(i, 1, k)
	{
		int x; cin >> x;
		marked[x] = 1;
		v.pb(x);
	}

	if (k == n) {cout << -1 << endl; return;}

	int y = v.back(); v.pop_back();
	t.pb(y);

	vector<pll> p;

	rep(i, 1, n)
	if (!marked[i])
		t.pb(i);

	rep(i, 1, sz(t) - 1)
	p.pb(mp(t[i], t[i - 1]));
	p.pb(mp(v[0], t.back()));
	rep(i, 1, sz(v) - 1)
	p.pb(mp(v[i], v[i - 1]));

	m -= n - 1;

	rep(i, 2, sz(t) - 1)
	if (m > 0)
	{
		p.pb(mp(t[0], t[i]));
		m--;
	}

	for (auto it : v) t.pb(it);

	rep(i, 1, sz(t) - 1)
	rep(j, i + 2, sz(t) - 1)
	if (m > 0)
	{
		p.pb(mp(t[i], t[j]));
		m--;
	}

	if (m > 0) {cout << -1 << endl; return;}

	for (auto it : p) cout << it.fi << " " << it.se << endl;
}


//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;

ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}

ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}

int n, m, k;
bool marked[305];
vector<int> vertices;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin>>n>>m>>k;
    for(int i=1;i<=k;i++){
    	int a;
    	cin>>a;
    	marked[a] = true;
    }

    if(k == n || m == n*(n-1)/2){
    	cout<<"-1";
    	return 0;
    }

    int centre = -1;
    for(int i=1;i<=n;i++)
    	if(!marked[i]){
    		if(centre == -1)	centre = i;
    		else	vertices.pb(i);
    	}
    	else
    		vertices.pb(i);

    for(auto v : vertices)
    	cout<<centre<<" "<<v<<endl;
    m -= (n-1);
    for(int i=0;i<(int)vertices.size() && m>0;i++)
    	for(int j=i+1;j<(int)vertices.size() && m>0;j++){
    		m--;
    		cout<<vertices[i]<<" "<<vertices[j]<<endl;
    	}
    return 0;
}


//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;

ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}

ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}

int n, m, k;
bool marked[305];
vector<int> v_marked, v_unmarked;
vector<ii> ans;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin>>n>>m>>k;
    for(int i=1;i<=k;i++){
    	int a;
    	cin>>a;
    	marked[a] = true;
    }

    if(k == n || m == n*(n-1)/2){
    	cout<<"-1";
    	return 0;
    }

    int centre = -1;
    for(int i=1;i<=n;i++)
    	if(!marked[i]){
    		if(centre == -1)	centre = i;
    		else	v_unmarked.pb(i);
    	}
    	else
    		v_marked.pb(i);

    for(auto v : v_marked)
    	ans.pb({centre, v});
    for(auto v : v_unmarked)
    	ans.pb({centre, v});

    m -= (n-1);
    for(int i=0;i<(int)v_unmarked.size() && m>0;i++){
    	for(int j=i+1;j<(int)v_unmarked.size() && m>0;j++){
    		m--;
    		ans.pb({v_unmarked[i], v_unmarked[j]});
    	}
    	for(int j=0;j<(int)v_marked.size() && m>0;j++){
    		m--;
    		ans.pb({v_unmarked[i], v_marked[j]});
    	}
    }

    int v1, v2;
    if((int)v_marked.size() >= 2){
    	v1 = v_marked.back();
    	v_marked.pop_back();
    	v2 = v_marked.back();
    	v_marked.pop_back();
    }
    else if((int)v_marked.size() == 1){
    	v1 = v_marked.back();
    	v_marked.pop_back();
    	v2 = v_unmarked.back();
    	v_unmarked.pop_back();
    }
    else{
    	v1 = v_unmarked.back();
    	v_unmarked.pop_back();
    	v2 = v_unmarked.back();
    	v_unmarked.pop_back();
    }

    for(int i=0;i<(int)v_marked.size() && m>0;i++){
    	for(int j=i+1;j<(int)v_marked.size() && m>0;j++){
    		m--;
    		ans.pb({v_marked[i], v_marked[j]});
    	}
    	if(m > 0){
    		m--;
    		ans.pb({v_marked[i], v1});
    	}
    }

    if(m != 0){
    	cout<<"-1";
    	return 0;
    }

    for(auto it : ans)
    	cout<<it.ff<<" "<<it.ss<<endl;
    return 0;
}


#include<vector>
#include<complex>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
int n, m, k;
int check[333];
int how[333][333];
int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= k; i++) {
		int temp; scanf("%d", &temp);
		check[temp] = 1;
	}
	if (k == n||(n-1)*(n-2)/2+n-k<m) {
		printf("-1");
		return 0;
	}
	int x = 1,y=1,z=1;
	while (!check[x])x++;
	while (check[y])y++;
	z = x + 1;
	while (!check[z])z++;

	for (int i = 1; i <= n; i++) {
		if (i == x)continue;
		for (int j = 1; j <= n; j++) {
			if (j == i||j==x)continue;
			how[i][j] = 1;
		}
	}
	for (int i = 1; i <= n; i++) {
		if (!check[i]) {
			how[i][x] = how[x][i] = 1;
		}
	}
	printf("%d %d\n%d %d\n", x, y, y, z);
	int when = m - 2;
	if (when == 0)return 0;
	for (int i = 1; i <= n; i++) {
		for (int j =i+1; j <= n; j++) {
			if (i == x&&j == y)continue;
			if (i == y&&j == x)continue;
			if (i == y&&j == z)continue;
			if (i == z&&j == y)continue;
			if (how[i][j]) {
				printf("%d %d\n", i, j);
				when--;
				if (!when)return 0;
			}
		}
	}

}


#include<vector>
#include<complex>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
int n, m, k;
int check[333];
int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= k; i++) {
		int temp; scanf("%d", &temp);
		check[temp] = 1;
	}
	if (k == n||(n-1)*(n-2)/2+n-k<m) {
		printf("-1");
		return 0;
	}
	int x = 1,y=1,z=1;
	while (!check[x])x++;
	while (check[y])y++;
	while (!check[z] || x == z)z++;

	printf("%d %d\n%d %d\n", x, y, y, z);
	int when = m - 2;
	if (when == 0)return 0;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (i == x&&j == y)continue;
			if (i == y&&j == x)continue;
			if (i == y&&j == z)continue;
			if (i == z&&j == y)continue;
			if ((i == x&&!check[j])||!check[i]) {
				when--;
				printf("%d %d\n", i, j);
				if (when == 0)return 0;
			}
		}
	}

}


#include<vector>
#include<complex>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
int n, m, k;
int check[333];
int t[333][333];

int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= k; i++) {
		int temp; scanf("%d", &temp);
		check[temp] = 1;
	}
	if (k == n||(n-1)*(n-2)/2+n-k<m) {
		printf("-1");
		return 0;
	}
	int x = 1,y=1,z=1;
	while (!check[x])x++;
	while (check[y])y++;
	vector<pair<int, int> >v;
	v.push_back(make_pair(x, y));
	int bf = 1;
	int cur = 2;
	if (bf == x) {
		bf++; cur++;
	}
	for (; cur <= n; cur++) {
		if (cur == x)continue;
		t[bf][cur] = 1;
		v.push_back(make_pair(bf, cur));
		bf = cur;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (i == x&&j == y)continue;
			if (i == y&&j == x)continue;
			if (t[i][j])continue;
			if (!check[i])v.push_back(make_pair(i, j));
			else {
				if (i == x) {
					if(!check[j])v.push_back(make_pair(i, j));
				}
				else {
					if(j!=x)v.push_back(make_pair(i, j));
				}
			}
		}
	}
	for (int i = 0; i < m; i++)
		printf("%d %d\n", v[i].first, v[i].second);
}


#include<vector>
#include<complex>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
int n, m, k;
int check[333];
int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= k; i++) {
		int temp; scanf("%d", &temp);
		check[temp] = 1;
	}
	if (k == n||(n-1)*(n-2)/2+n-k<m) {
		printf("-1");
		return 0;
	}
	int x = 1,y=1,z=1;
	while (!check[x])x++;
	while (check[y])y++;
	while (!check[z] || x == z)z++;

	printf("%d %d\n%d %d\n", x, y, y, z);
	int when = m - 2;
	if (when == 0)return 0;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (i == x&&j == y)continue;
			if (i == y&&j == x)continue;
			if (i == y&&j == z)continue;
			if (i == z&&j == y)continue;
			if ((i==x&&!check[j])||(i!=x&&j==x&&!check[i])) {
				when--;
				printf("%d %d\n", i, j);
				if (when == 0)return 0;
			}
		}
	}

}


#include<vector>
#include<complex>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
int n, m, k;
int check[333];
int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= k; i++) {
		int temp; scanf("%d", &temp);
		check[temp] = 1;
	}
	if (k == n||(n-1)*(n-2)/2+n-k<m) {
		printf("-1");
		return 0;
	}
	int x = 1,y=1,z=1;
	while (!check[x])x++;
	while (check[y])y++;
	while (!check[z] || x == z)z++;

	printf("%d %d\n%d %d\n", x, y, y, z);
	vector<pair<int, int> > v;
	int when = m - 2;
	if (when == 0)return 0;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (i == x&&j == y)continue;
			if (i == y&&j == x)continue;
			if (i == y&&j == z)continue;
			if (i == z&&j == y)continue;
			if ((i == x&&check[j])||!check[i]) {
				when--;
				printf("%d %d\n", i, j);
				if (when == 0)return 0;
			}
		}
	}

}


#include<vector>
#include<complex>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
int n, m, k;
int check[333];
int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= k; i++) {
		int temp; scanf("%d", &temp);
		check[temp] = 1;
	}
	if (k == n||(n-1)*(n-2)/2+n-k<m) {
		printf("-1");
		return 0;
	}
	int x = 1,y=1,z=1;
	while (!check[x])x++;
	while (check[y])y++;
	while (!check[z] || x == z)z++;

	printf("%d %d\n%d %d\n", x, y, y, z);
	int when = m - 2;
	if (when == 0)return 0;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (i == x&&j == y)continue;
			if (i == y&&j == x)continue;
			if (i == y&&j == z)continue;
			if (i == z&&j == y)continue;
			int yes = 0;
			if (i==x) {
				if(!check[j])
					yes = 1;
			}
			else {
				if (!check[j])yes=1;
				else if (j!=x)yes = 1;
			}
			if (yes) {
				when--;
				printf("%d %d\n", i, j);
				if (when == 0)return 0;
			}
		}
	}

}


#include<vector>
#include<complex>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
int n, m, k;
int check[333];
int how[333][333];
int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= k; i++) {
		int temp; scanf("%d", &temp);
		check[temp] = 1;
	}
	if (k == n||(n-1)*(n-2)/2+n-k<m) {
		printf("-1");
		return 0;
	}
	int x = 1,y=1,z=1;
	while (!check[x])x++;
	while (check[y])y++;
	while (!check[z] || x == z)z++;

	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (!check[i])how[i][j] = 1;
			else {
				if (i == x) {
					if (!check[j])how[i][j] = 1;
				}
				else {
					if (j != x)how[i][j] = 1;
				}
			}
		}
	}
	printf("%d %d\n%d %d\n", x, y, y, z);
	int when = m - 2;
	if (when == 0)return 0;
	for (int i = 1; i <= n; i++) {
		for (int j =i+1; j <= n; j++) {
			if (i == x&&j == y)continue;
			if (i == y&&j == x)continue;
			if (i == y&&j == z)continue;
			if (i == z&&j == y)continue;
			if (how[i][j]) {
				printf("%d %d\n", i, j);
				when--;
				if (!when)return 0;
			}
		}
	}

}


#include<vector>
#include<complex>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
int n, m, k;
int check[333];

int main() {
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= k; i++) {
		int temp; scanf("%d", &temp);
		check[temp] = 1;
	}
	if (k == n||(n-1)*(n-2)/2+n-k<m) {
		printf("-1");
		return 0;
	}
	int x = 1;
	while (!check[x])x++;
	vector<pair<int, int> > v;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (i == x) {
				if (!check[j])
					v.push_back(make_pair(i, j));
			}
			else
				v.push_back(make_pair(i, j));
		}
	}
	while (m--) {
		printf("%d %d\n", v[m].first, v[m].second);
	}
}


#include <bits/stdc++.h>

using namespace std;

const double eps = 1e-7;

int main() {
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int n, m, k;
  cin >> n >> m >> k;
  vector <int> mark(n);
  for (int i = 0; i < k; ++i) {
    int x;
    cin >> x;
    mark[--x] = 1;
  }
  if (k == n) {
    cout << -1 << endl;
    return 0;
  }
  if (m > n * (n - 1) / 2 - (k - 1)) {
    cout << -1 << endl;
    return 0;
  }
  int v = -1, u = -1;;
  for (int i = 0; i < n; ++i) {
    if (!mark[i]) {
      v = i;
    }
    if (mark[i]) {
      u = i;
    }
  }
  vector <pair <int, int> > g;
  for (int i = 0; i < n; ++i) {
    if (i != v) {
      g.push_back({v, i});
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      if (i == v || j == v) {
        continue;
      }
      if ((i == u && mark[j]) || (j == u && mark[i])) {
        continue;
      }
      if (g.size() == m) {
        break;
      }
      g.push_back({i, j});
    }
  }
  for (auto e: g) {
    cout << e.first + 1 << ' ' << e.second + 1 << endl;
  }
}


#include <bits/stdc++.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
using namespace std;
const ll maxn=1e6+123,inf=1e9+123,LOG=18,block=450,mod=1e9+7,N=1e6+123;
int n,m,k,x[maxn],was[maxn],used[500][500];
vector< pair<int,int> > ans;
int main(){
    #ifdef LOCAL
		freopen ("test.in", "r", stdin);
	#endif
	cin>>n>>m>>k;
	for(int i=1;i<=k;i++){
		cin>>x[i];
		was[x[i]]=1;
	}
	int a=x[1],b=x[2],c;
	for(int i=1;i<=n;i++)
		if( !was[i] )
			c=i;
	m-=2;
	ans.pb(mp(a,c));
	ans.pb(mp(c,b));
	used[a][c]=1;
	used[c][b]=1;
	used[b][c]=1;
	used[c][a]=1;

	for(int i=1;i<=n;i++)
		used[i][i]=1;

    for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if( i!=b && j!=b){
				if(!used[i][j] && m){
					m--;
					used[i][j]=1;
					used[j][i]=1;
					ans.pb(mp(i,j));
				}
			}
		}
	}
	if(m!=0)
		return cout<<-1,0;
	for(int i=0;i<ans.size();i++)
		cout<<ans[i].f<<" "<<ans[i].s<<endl;
}


#include <bits/stdc++.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
using namespace std;
const ll maxn=1e6+123,inf=1e9+123,LOG=18,block=450,mod=1e9+7,N=1e6+123;
int n,m,k,x[maxn],was[maxn],used[500][500];
vector< pair<int,int> > ans;
int main(){
    #ifdef LOCAL
		freopen ("test.in", "r", stdin);
	#endif
	cin>>n>>m>>k;
	for(int i=1;i<=k;i++){
		cin>>x[i];
		was[x[i]]=1;
	}
	int a=x[1],b=x[2],c;
	for(int i=1;i<=n;i++)
		if( !was[i] )
			c=i;
	m-=2;
	ans.pb(mp(a,c));
	ans.pb(mp(c,b));
	used[a][c]=1;
	used[c][b]=1;
	used[b][c]=1;
	used[c][a]=1;

	for(int i=1;i<=n;i++)
		used[i][i]=1;

    for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if( i!=b && j!=b){
				if(!used[i][j] && m){
					m--;
					used[i][j]=1;
					used[j][i]=1;
					ans.pb(mp(i,j));
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(!used[i][b] && !was[i]){
			m--;
			used[i][b]=1;
			used[b][i]=1;
			ans.pb(mp(i,b));
		}
	}
	if(m!=0)
		return cout<<-1,0;
	for(int i=0;i<ans.size();i++)
		cout<<ans[i].f<<" "<<ans[i].s<<endl;
}


#include <bits/stdc++.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
using namespace std;
const ll maxn=1e6+123,inf=1e9+123,LOG=18,block=450,mod=1e9+7,N=1e6+123;
int n,m,k,x[maxn],was[maxn],used[500][500];
vector< pair<int,int> > ans;
int main(){
    #ifdef LOCAL
		freopen ("test.in", "r", stdin);
	#endif
	cin>>n>>m>>k;
	if(k==n)
		return cout<<-1,0;
	for(int i=1;i<=k;i++){
		cin>>x[i];
		was[x[i]]=1;
	}
	int a=x[1],b=x[2],c;
	for(int i=1;i<=n;i++)
		if( !was[i] )
			c=i;
	m-=2;
	ans.pb(mp(a,c));
	ans.pb(mp(c,b));
	used[a][c]=1;
	used[c][b]=1;
	used[b][c]=1;
	used[c][a]=1;
	for(int i=1;i<=n;i++)
		used[i][i]=1;

    for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if( i!=b && j!=b){
				if(!used[i][j] && m){
					m--;
					used[i][j]=1;
					used[j][i]=1;
					ans.pb(mp(i,j));
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(!used[i][b] && !was[i] && m){
			m--;
			used[i][b]=1;
			used[b][i]=1;
			ans.pb(mp(i,b));
		}
	}
	if(m!=0)
		return cout<<-1,0;
	for(int i=0;i<ans.size();i++)
		cout<<ans[i].f<<" "<<ans[i].s<<endl;
}


#include <bits/stdc++.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
using namespace std;
const ll maxn=1e6+123,inf=1e9+123,LOG=18,block=450,mod=1e9+7,N=1e6+123;
int n,m,k,x[maxn],was[maxn],used[500][500];
vector< pair<int,int> > ans;
int main(){
    #ifdef LOCAL
		freopen ("test.in", "r", stdin);
	#endif
	cin>>n>>m>>k;
	for(int i=1;i<=k;i++){
		cin>>x[i];
		was[x[i]]=1;
	}
	int a=x[1],b=x[2],c;
	for(int i=1;i<=n;i++)
		if( !was[i] )
			c=i;
	m-=2;
	ans.pb(mp(a,c));
	ans.pb(mp(c,b));
	used[a][c]=1;
	used[c][b]=1;
	used[b][c]=1;
	used[c][a]=1;

	for(int i=1;i<=n;i++)
		used[i][i]=1;

    for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if( i!=b && j!=b){
				if(!used[i][j] && m){
					m--;
					used[i][j]=1;
					used[j][i]=1;
					ans.pb(mp(i,j));
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(!used[i][b] && !was[i] && m){
			m--;
			used[i][b]=1;
			used[b][i]=1;
			ans.pb(mp(i,b));
		}
	}
	if(m!=0)
		return cout<<-1,0;
	for(int i=0;i<ans.size();i++)
		cout<<ans[i].f<<" "<<ans[i].s<<endl;
}


#include <bits/stdc++.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
using namespace std;
const ll maxn=1e6+123,inf=1e9+123,LOG=18,block=450,mod=1e9+7,N=1e6+123;
int n,m,k,x[maxn],was[maxn],used[500][500];
vector< pair<int,int> > ans;
int main(){
    #ifdef LOCAL
		freopen ("test.in", "r", stdin);
	#endif
	cin>>n>>m>>k;
	if(k==n)
		return cout<<-1,0;
	for(int i=1;i<=k;i++){
		cin>>x[i];
		was[x[i]]=1;
	}
	int a=x[1],b=x[2],c;
	for(int i=1;i<=n;i++)
		if( !was[i] )
			c=i;
	for(int i=1;i<=n;i++)
		used[i][i]=1;
    for(int i=1;i<=n;i++)
    	if( m && !used[i][c]){
    		m--;
			used[i][c]=1;
			used[c][i]=1;
			ans.pb(mp(i,c));
		}
    for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if( i!=b && j!=b){
				if(!used[i][j] && m){
					m--;
					used[i][j]=1;
					used[j][i]=1;
					ans.pb(mp(i,j));
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(!used[i][b] && !was[i] && m){
			m--;
			used[i][b]=1;
			used[b][i]=1;
			ans.pb(mp(i,b));
		}
	}
	if(m!=0)
		return cout<<-1,0;
	for(int i=0;i<ans.size();i++)
		cout<<ans[i].f<<" "<<ans[i].s<<endl;
}


#include <bits/stdc++.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
using namespace std;
const ll maxn=1e6+123,inf=1e9+123,LOG=18,block=450,mod=1e9+7,N=1e6+123;
int n,m,k,x[maxn],was[maxn],used[500][500];
vector< pair<int,int> > ans;
int main(){
    #ifdef LOCAL
		freopen ("test.in", "r", stdin);
	#endif
	cin>>n>>m>>k;
	if(k==n)
		return cout<<"YES",0;
	for(int i=1;i<=k;i++){
		cin>>x[i];
		was[x[i]]=1;
	}
	int a=x[1],b=x[2];

	for(int i=1;i<=n;i++)
		used[i][i]=1;

    for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if( i!=b && j!=b){
				if(!used[i][j] && m){
					m--;
					used[i][j]=1;
					used[j][i]=1;
					ans.pb(mp(i,j));
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(!used[i][b] && !was[i] && m){
			m--;
			used[i][b]=1;
			used[b][i]=1;
			ans.pb(mp(i,b));
		}
	}
	if(m!=0)
		return cout<<-1,0;
	for(int i=0;i<ans.size();i++)
		cout<<ans[i].f<<" "<<ans[i].s<<endl;
}


#include <bits/stdc++.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
using namespace std;
const ll maxn=1e6+123,inf=1e9+123,LOG=18,block=450,mod=1e9+7,N=1e6+123;
int n,m,k,x[maxn],was[maxn],used[500][500];
vector< pair<int,int> > ans;
int main(){
    #ifdef LOCAL
		freopen ("test.in", "r", stdin);
	#endif
	cin>>n>>m>>k;
	if(k==n)
		return cout<<-1,0;
	for(int i=1;i<=k;i++){
		cin>>x[i];
		was[x[i]]=1;
	}
	int a=x[1],b=x[2];

	for(int i=1;i<=n;i++)
		used[i][i]=1;

    for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if( i!=b && j!=b){
				if(!used[i][j] && m){
					m--;
					used[i][j]=1;
					used[j][i]=1;
					ans.pb(mp(i,j));
				}
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(!used[i][b] && !was[i] && m){
			m--;
			used[i][b]=1;
			used[b][i]=1;
			ans.pb(mp(i,b));
		}
	}
	if(m!=0)
		return cout<<-1,0;
	for(int i=0;i<ans.size();i++)
		cout<<ans[i].f<<" "<<ans[i].s<<endl;
}


#include <bits/stdc++.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define o cout<<"BUG"<<endl;
#define	IOS ios_base::sync_with_stdio(0);
using namespace std;
const ll maxn=1e6+123,inf=1e9+123,LOG=18,block=450,mod=1e9+7,N=1e6+123;
int n,m,k,x[maxn],was[maxn],used[500][500];
vector< pair<int,int> > ans;
int main(){
    #ifdef LOCAL
		freopen ("test.in", "r", stdin);
	#endif
	cin>>n>>m>>k;
	for(int i=1;i<=k;i++){
		cin>>x[i];
		was[x[i]]=1;
	}
	int a=x[1],b=x[2],c;
	for(int i=1;i<=n;i++)
		if( !was[i] )
			c=i;
	m-=2;
	ans.pb(mp(a,c));
	ans.pb(mp(c,b));
	used[a][c]=1;
	used[c][b]=1;
	used[b][c]=1;
	used[c][a]=1;

	for(int i=1;i<=n;i++)
		used[i][i]=1;

    for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if( i!=c && j!=c){
				if(!used[i][j] && m){
					k--;
					used[i][j]=1;
					used[j][i]=1;
					ans.pb(mp(i,j));
				}
			}
		}
	}
	if(m!=0)
		return cout<<-1,0;
	for(int i=0;i<ans.size();i++)
		cout<<ans[i].f<<" "<<ans[i].s<<endl;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;

#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)

#define F first
#define S second
#define pb push_back

void solve(){
	ll n,m,k;
	cin>>n>>m>>k;

	vector<int> a(k);
	forn(i,k){
		cin>>a[i];
		a[i]--;
	}

	if(k == n){
		cout<<"-1"<<endl;
	}else if(m > n*(n-1)/2 - k + 1){
		cout<<"-1"<<endl;
	}else{
		int fixed = a[0];

		vector<vector<bool> > edges(n);
		forn(i,n){
			edges[i].resize(n);
			forn(j,n){
				if(i != j) {
					edges[i][j] = true;
				}else{
					edges[i][j] = false;
				}
			}
		}

		for(int i=1;i<k;i++){
			edges[fixed][a[i]] = false;
			edges[a[i]][fixed] = false;
		}

		ll extra = n*(n-1)/2 - k + 1 - m;
		bool done = false;

		if(extra == 0){
			done = true;
		}

		while(!done){
			forn(i,n){
				forn(j,n){
					if(edges[i][j]){
						edges[i][j] = false;
						edges[j][i] = false;
						extra--;

						if(extra == 0){
							done = true;
							break;
						}
					}
				}
				if(done){
					break;
				}
			}
		}

		forn(i,n){
			for(int j=i+1;j<n;j++){
				if(edges[i][j]){
					cout<<i+1<<" "<<j+1<<endl;
				}
			}
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);

	int t = 1;
	// cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
#define F first
#define S second
#define pb push_back

void solve(){
	int n,m,k;
	cin>>n>>m>>k;

	vector<int> a(k);
	vector<bool> present(n+1, false);
	for(int i=0;i<k;i++){
		cin>>a[i];
		present[a[i]] = true;
	}

	if(k == n){
		cout<<"-1"<<endl;
		return;
	}

	int missing;
	for(int i=1;i<=n;i++){
		if(!present[i]){
			missing = i;
			break;
		}
	}

	int isolated;
	if(missing == 1){
		isolated = 2;
	}else{
		isolated = 1;
	}

	// cout<<missing<<isolated<<endl;

	if(m > 1 + (n-1)*(n-2)/2){
		cout<<"-1"<<endl;
		return;
	}

	vector<vector<bool> > edges(n+1);
	for(int i=1;i<=n;i++){
		edges[i].resize(n+1);
		for(int j=0;j<n+1;j++){
			edges[i][j] = 0;
		}
	}

	for(int i=1;i<=n;i++){
		if(missing != i){
			edges[i][missing] = true;
			edges[missing][i] = true;
		}
	}

	m = m - (n-1);
	bool done = false;

	// cout<<missing<<isolated<<endl;

	if(m == 0){
		done = true;
	}

	while(!done){
		for(int i=1;i<=n;i++){
			if(missing != i && isolated != i){
				for(int j=1;j<=n;j++){
					if(missing != j && isolated != j){
						if(!edges[i][j]){
							edges[i][j] = true;
							edges[j][i] = true;
							m--;

							if(m == 0){
								done = true;
								break;
							}
						}
					}
				}
			}

			if(done){
				break;
			}
		}

		if(done){
			break;
		}
	}

	for(int i=1;i<=n;i++){
		for(int j = i+1;j<=n;j++){
			if(edges[i][j]){
				cout<<i<<" "<<j<<endl;
			}
		}
	}

}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);

	int t = 1;
	// cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
#define F first
#define S second
#define pb push_back

void solve(){
	int n,m,k;
	cin>>n>>m>>k;

	vector<int> a(k);
	vector<bool> present(n+1, false);
	for(int i=0;i<k;i++){
		cin>>a[i];
		present[a[i]] = true;
		// cout<<a[i]<<endl;
	}

	if(k == n){
		cout<<"-1"<<endl;
		return;
	}

	int missing;
	for(int i=1;i<=n;i++){
		if(!present[i]){
			missing = i;
			break;
		}
	}

	int isolated;
	if(missing == 1){
		isolated = 2;
	}else{
		isolated = 1;
	}

	// cout<<missing<<isolated<<endl;

	if(m > 1 + (n-1)*(n-2)/2){
		cout<<"-1"<<endl;
		return;
	}

	vector<vector<bool> > edges(n+1);
	for(int i=1;i<=n;i++){
		edges[i].resize(n+1);
		for(int j=0;j<n+1;j++){
			edges[i][j] = 0;
		}
	}

	for(int i=1;i<=n;i++){
		if(missing != i){
			edges[i][missing] = true;
			edges[missing][i] = true;
		}
	}

	m = m - (n-1);
	bool done = false;

	// cout<<missing<<isolated<<endl;

	if(m == 0){
		done = true;
	}

	while(!done){
		for(int i=1;i<=n;i++){
			if(isolated != i){
				for(int j=1;j<=n;j++){
					if(isolated != j){
						if(!edges[i][j] && i!=j){
							edges[i][j] = true;
							edges[j][i] = true;
							m--;

							// cout<<i<<" "<<j<<endl;

							if(m == 0){
								done = true;
								break;
							}
						}
					}
				}
			}

			if(done){
				break;
			}
		}

		if(done){
			break;
		}
	}

	int cnt = 0;

	for(int i=1;i<=n;i++){
		for(int j = i+1;j<=n;j++){
			if(edges[i][j]){
				cout<<i<<" "<<j<<endl;
				cnt++;
			}
		}
	}

	// cout<<cnt<<endl;

}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);

	int t = 1;
	// cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;

#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)

#define F first
#define S second
#define pb push_back

void solve(){
	ll n,m,k;
	cin>>n>>m>>k;

	vector<int> a(k);
	vector<int> ispresent(n, false);
	forn(i,k){
		cin>>a[i];
		a[i]--;
		ispresent[a[i]] = true;
	}

	if(k == n){
		cout<<"-1"<<endl;
	}else if(m > n*(n-1)/2 - k + 1){
		cout<<"-1"<<endl;
	}else{

		int cannot_be_deleted;
		for(int i=0;i<n;i++){
			if(!ispresent[i]){
				cannot_be_deleted = i;
				break;
			}
		}

		int fixed = a[0];

		vector<vector<bool> > edges(n);
		forn(i,n){
			edges[i].resize(n);
			forn(j,n){
				if(i != j) {
					edges[i][j] = true;
				}else{
					edges[i][j] = false;
				}
			}
		}

		for(int i=1;i<k;i++){
			edges[fixed][a[i]] = false;
			edges[a[i]][fixed] = false;
		}

		ll extra = n*(n-1)/2 - k + 1 - m;
		bool done = false;

		if(extra == 0){
			done = true;
		}

		while(!done){
			forn(i,n){
				forn(j,n){
					if(edges[i][j] && i!=cannot_be_deleted && j!=cannot_be_deleted){
						edges[i][j] = false;
						edges[j][i] = false;
						extra--;

						if(extra == 0){
							done = true;
							break;
						}
					}
				}
				if(done){
					break;
				}
			}
		}

		forn(i,n){
			for(int j=i+1;j<n;j++){
				if(edges[i][j]){
					cout<<i+1<<" "<<j+1<<endl;
					// sum++;
				}
			}
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);

	int t = 1;
	// cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>

const int N = 307;

int a[N];
bool b[N];

int main ()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);

	int n, m, k;

	std::cin >> n >> m >> k;

	if(k == n)
	{
		std::cout << "-1\n";

		return 0;
	}

	if(m > n*(n-1)/2 - k + 1)
	{
		std::cout << "-1\n";

		return 0;
	}

	for(int i = 0; i < k; i++)
	{
		std::cin >> a[i];
		b[ a[i] ] = true;
	}

	std::sort(a, a+k);

	int v = 1;

	for(int i = 0; i < k; i++)
	{
		if(a[i] != v)
			break;
		v++;
	}

	for(int i = 1; i <= n; i++)
		if(i != a[0] && i != a[1])
		{
			std::cout << a[0] << " " << i << "\n";
		}

	std::cout << a[1] << " " << v << "\n";

	m -= n-1;

	for(int i = 1; i <= n; i++)
		for(int j = i+1; j <= n; j++)
		{
			if(!m)
				break;

			if(a[0] == i || a[0] == j)
				continue;
			if(a[1] == i && a[1] == j)
				if(b[i] && b[j])
					continue;

			std::cout << i << " " << j << "\n";

			m--;
		}

	return 0;
}


#include <bits/stdc++.h>

const int N = 307;

int a[N];
bool b[N];

int main ()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);

	int n, m, k;

	std::cin >> n >> m >> k;

	if(k == n)
	{
		std::cout << "-1\n";

		return 0;
	}

	if(m > n*(n-1)/2 - k + 1)
	{
		std::cout << "-1\n";

		return 0;
	}

	for(int i = 0; i < k; i++)
	{
		std::cin >> a[i];
		b[ a[i] ] = true;
	}

	std::sort(a, a+k);

	int v;

	for(v = 1; v <= n; v++)
		if(!b[v])
			break;

	for(int i = 1; i <= n; i++)
		if(i != a[0] && i != a[1])
		{
			std::cout << a[0] << " " << i << "\n";
		}

	std::cout << a[1] << " " << v << "\n";

	m -= n-1;

	for(int i = 1; i <= n; i++)
		for(int j = i+1; j <= n; j++)
		{
			if(!m)
				break;

			if(a[0] == i || a[0] == j)
				continue;
			if(a[1] == i && a[1] == j)
				if((b[i] && b[j]) || (i == v || j == v))
					continue;

			std::cout << i << " " << j << "\n";

			m--;
		}

	return 0;
}


#include <bits/stdc++.h>

const int N = 307;

int a[N];
bool b[N];

int main ()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);

	int n, m, k;

	std::cin >> n >> m >> k;

	if(k == n)
	{
		std::cout << "-1\n";

		return 0;
	}

	if(m > n*(n-1)/2 - k + 1)
	{
		std::cout << "-1\n";

		return 0;
	}

	for(int i = 0; i < k; i++)
	{
		std::cin >> a[i];
		b[ a[i] ] = true;
	}

	std::sort(a, a+k);

	int v;

	for(v = 1; v <= n; v++)
		if(!b[v])
			break;

	for(int i = 1; i <= n; i++)
		if(i != a[0] && i != a[1])
		{
			std::cout << a[0] << " " << i << "\n";
		}

	std::cout << a[1] << " " << v << "\n";

	m -= n-1;

	for(int i = 1; i <= n; i++)
		for(int j = i+1; j <= n; j++)
		{
			if(!m)
				break;

			if(a[0] == i || a[0] == j)
				continue;
			if(a[1] == i || a[1] == j)
				if((b[i] && b[j]) || (i == v || j == v))
					continue;

			std::cout << i << " " << j << "\n";

			m--;
		}

	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define x first
#define y second
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI (atan(1)*4)
#define mp make_pair
using namespace std;

int n, m, k, tmp;
int marked[400];
vector<int> v;
vector< pair<int, int> > edges;
int main()
{
	fastread;
	cin >> n >> m >> k;
	if (k == n) {
		cout << -1;
		return 0;
	}
	for (int i = 0; i < k; i++) {
		cin >> tmp;
		marked[tmp] = 1;
		v.pb(tmp);
	}
	for (int i = 1; i <= n && m != 0; i++) {
		if (marked[i])
			continue;
		for (int j = 1; j < i && m != 0; j++) {
			if (marked[j] == 0)
				continue;
			edges.pb({i, j});
			m--;
		}
		for (int j = i + 1; j <= n && m != 0; j++) {
			edges.pb({i, j});
			m--;
		}
	}
	for (int i = 0; i < (v.size() - 1) && m != 0; i++) {
		for (int j = i + 1; j < (v.size() - 1) && m != 0; j++) {
			edges.pb({v[i], v[j]});
			m--;
		}
	}
	if (m != 0) {
		cout << -1;
		return 0;
	}
	for (auto u : edges)
		cout << u.x << " " << u.y << '\n';
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll f(ll x){
    return x*(x-1)/2;
}

vector<int>g[303];
int m1[303][303];
int m2[303][303];
int main(){

    //freopen("input.in", "r", stdin);freopen("input.out", "w", stdout);

    int n, m, k;
    cin>>n>>m>>k;
    vector<int>a(k);
    vector<int>c(n+1, 0);
    for (int i=0; i<k; i++){
        cin>>a[i];
        c[a[i]]=1;
    }
    vector<pair<int, int>>r;
    if (k==n){
        cout<<-1;
        return 0;
    }
    int V, X;
    for (int x=1; x<=n; x++){
        if (!c[x])
            V=x;
        else
            X=x;
    }

    m--;
    r.push_back({X, V});

    for (int x=1; x<=n; x++){
        if (x==V || x==X)
            continue;
        if (m>0){
            r.push_back({x, V});
            m--;
        }
    }
    for (int x=1; x<=n; x++){
        if (x==V || x==X)
            continue;
        for (int y=x+1; y<=n; y++){
            if (y==V || y==X)
                continue;
            if (m>0){
                m--;
               // cout<<x<<" ! "<<y<<endl;
                r.push_back({x, y});
            }
        }
    }

    for (int x=1; x<=n; x++){
        if (X==x || V==x || c[x])
            continue;
        if (m>0){
            m--;
            r.push_back({X, x});;
        }
    }
    if (m){
        cout<<-1;
        return 0;
    }
    for (int i=0; i<r.size(); i++){
        cout<<r[i].first<<" "<<r[i].second<<endl;
    }
    return 0;
}

/* Thu Jan 30 2020 13:53:11 GMT+0300 (MSK) */

/* Fri Jan 31 2020 01:12:26 GMT+0300 (MSK) */


#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

int n, m, k;
int arr[310];
int adj[310][310];
int cnt[310];
int h;
int ans = 0;
int main(void) {
	scanf("%d%d%d", &n, &m, &k);

	for (int i = 1; i <= k; i++) scanf("%d", arr + i), cnt[arr[i]]++;
	sort(arr + 1, arr + 1 + k);

	if (k == n) { printf("-1"); return 0; }
	if (m > n * (n - 1) / 2 - k + 1) { printf("-1"); return 0; }

	for (int i = 1; i <= n; i++) if (cnt[i] == 0) h = i;

	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			adj[i][j] = 1;
		}
	}

	for (int i = 2; i <= k; i++) adj[arr[1]][arr[i]] = 0;

	printf("%d %d\n", min(arr[1], h), max(arr[1], h));
	printf("%d %d\n", min(h, arr[2]), max(arr[2], h));
	ans = 2;
	if (ans == m) return 0;

	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (adj[i][j] == 0) continue;
			if (i == min(arr[1], h) && j == max(arr[1], h)) continue;
			if (i == min(h, arr[2]) && j == max(arr[2], h)) continue;

			printf("%d %d\n", i, j);
			if (++ans == m) return 0;
		}
	}

	return 0;
}


#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

int n, m, k;
int arr[310];
int adj[310][310];
int cnt[310];
int h;
int ans = 0;
int main(void) {
	scanf("%d%d%d", &n, &m, &k);

	for (int i = 1; i <= k; i++) scanf("%d", arr + i), cnt[arr[i]]++;
	sort(arr + 1, arr + 1 + k);

	if (k == n) { printf("-1"); return 0; }
	if (m > n * (n - 1) / 2 - k + 1) { printf("-1"); return 0; }

	for (int i = 1; i <= n; i++) if (cnt[i] == 0) h = i;

	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			adj[i][j] = 1;
		}
	}

	for (int i = 2; i <= k; i++) adj[arr[1]][arr[i]] = 0;

	printf("%d %d\n", min(arr[1], h), max(arr[1], h));
	printf("%d %d\n", min(h, arr[2]), max(arr[2], h));
	ans = 2;
	if (ans == m) return 0;

	for (int i = 1; i <= k; i++) {
		for (int j = 2; j <= k; j++) {
			if (adj[i][j] == 0) continue;
			if (i == min(arr[1], h) && j == max(arr[1], h)) continue;
			if (i == min(h, arr[2]) && j == max(arr[2], h)) continue;

			printf("%d %d\n", i, j);
			if (++ans == m) return 0;
		}
	}

	return 0;
}


#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

int n, m, k;
int arr[310];
int adj[310][310];
int cnt[310];
int h;
int ans = 0;
int main(void) {
	scanf("%d%d%d", &n, &m, &k);

	for (int i = 1; i <= k; i++) scanf("%d", arr + i), cnt[arr[i]]++;
	sort(arr + 1, arr + 1 + k);

	if (k == n) { printf("-1"); return 0; }
	if (m > n * (n - 1) / 2 - k + 1) { printf("-1"); return 0; }

	for (int i = 1; i <= n; i++) if (cnt[i] == 0) h = i;

	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			adj[i][j] = 1;
		}
	}

	for (int i = 2; i <= k; i++) adj[arr[1]][arr[i]] = 0;

	for (int i = 1; i <= n; i++) if (i != h) printf("%d %d\n", min(i, h), max(i, h));
	ans = n - 1;
	if (ans == m) return 0;

	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (adj[i][j] == 0) continue;
			if (i == h || j == h) continue;

			printf("%d %d\n", i, j);
			if (++ans == m) return 0;
		}
	}

	return 0;
}


#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

int n, m, k;
int arr[310];
int adj[310][310];
int cnt[310];
int h;
int ans = 0;
int main(void) {
	scanf("%d%d%d", &n, &m, &k);

	for (int i = 1; i <= k; i++) scanf("%d", arr + i), cnt[arr[i]]++;
	sort(arr + 1, arr + 1 + k);

	if (k == n) { printf("-1"); return 0; }
	if (m > n * (n - 1) / 2 - k + 1) { printf("-1"); return 0; }

	for (int i = 1; i <= n; i++) if (cnt[i] == 0) h = i;

	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			adj[i][j] = 1;
		}
	}

	for (int i = 2; i <= k; i++) adj[arr[1]][arr[i]] = 0;

	for (int i = 1; i <= n; i++) if (i != h) printf("%d %d\n", min(i, h), max(i, h));
	if (ans == m) return 0;

	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			if (adj[i][j] == 0) continue;
			if (i == h || j == h) continue;

			printf("%d %d\n", i, j);
			if (++ans == m) return 0;
		}
	}

	return 0;
}


#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
inline int in() {int x ; scanf("%d",&x) ; return x;}
unordered_map<int,vector<int>> graph;
vector<pair<int,int>> edge,ans;
bool searched[500];
int markedVertices[500];
int n,m,k;
void no();
void dfs(int vertex , int previous = -1);
void edge_add(int f , int s);
int main()
{
    n = in() , m = in() , k = in();
    if (k == n)
        no();
    for (int i = 0 ; i < k ; i ++)
        markedVertices[i] = in();
    sort(markedVertices,markedVertices+k);
    for (int f = 1 ; f < n ; f ++)
        for (int s = f+1 ; s <= n ; s++)
            if (s != markedVertices[0] && s != markedVertices[1] && f != markedVertices[0] && f != markedVertices[1])
                edge_add(f, s);
    for (int i = 1 ; i <= n; i ++)
        if (!binary_search(markedVertices,markedVertices+k,i))
            edge_add(i, markedVertices[0]) , edge_add(i, markedVertices[1]);
        else if (markedVertices[1] != i && markedVertices[0] != i)
            edge_add(i, markedVertices[0]);
    for (int i = 1 ; i <= n ; i ++)
    {
        if (!binary_search(markedVertices,markedVertices+k,i))
        {
            dfs(i);
            sort(ans.begin(),ans.end());
            break;
        }
    }
    if (edge.size() < m)
        no();
    for (int i = 0 ; i < edge.size() ;  i ++)
    {
        if (!binary_search(ans.begin(),ans.begin()+n-1,edge[i]))
        {
            if (ans.size() < m)
            {
                ans.push_back(edge[i]);
            }
        }
    }
    for (int i = 0 ; i < ans.size() ; i ++)
        cout << ans[i].first << " " << ans[i].second << endl;
}
void no()
{
    cout << -1 << endl;
    exit(0);
}
void edge_add(int f , int s)
{
    graph[f].push_back(s);
    graph[s].push_back(f);
    edge.push_back(make_pair(min(f,s),max(f,s)));
}
void dfs(int vertex , int previous)
{
    if (searched[vertex])
        return ;
    searched[vertex] = true;
    if (previous != -1)
    {
        ans.push_back(make_pair( min(vertex,previous),max(vertex,previous)  ));
    }
    for (int i = 0 ; i < graph[vertex].size() ; i ++)
    {
        int ver = graph[vertex][i];
        if (ver == previous) continue;
        dfs(ver,vertex);
    }
}


#include<bits/stdc++.h>
using namespace std;

int a[100005];
int marked[1000005];

int main()
{
    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);
    set<int>s;
    for(int i = 0; i < k; i++)
    {
        scanf("%d",&a[i]);
        s.insert(a[i]);
        marked[a[i]] = 1;
    }
    int center = 1;
    while(s.count(center) && center <= n) center++;
    //cout << " ** " << endl;
    vector<pair<int,int> >edges;
    for(int i = 0; i < k; i++)
        edges.push_back({a[i], center});
    vector<int>v;
    for(int i = 1; i <= n; i++)
    {
        if(!marked[i] && i != center)
        {
            v.push_back(i);
            edges.push_back({i, center});
        }
    }
    for(int i = 0; i < v.size() && edges.size() < m ; i++)
    {
        for(int j = i+1; j < v.size(); j++)
        {
            edges.push_back({v[i], v[j]});
        }
    }

    if(edges.size() < m || k == n)
    {
        puts("-1");
        return 0;
    }
    assert(edges.size() == m);
    for(auto &x : edges)
    {
        printf("%d %d\n",x.first,x.second);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int a[100005];
int marked[1000005];

int main()
{
    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);
    set<int>s;
    for(int i = 0; i < k; i++)
    {
        scanf("%d",&a[i]);
        s.insert(a[i]);
        marked[a[i]] = 1;
    }
    int center = 1;
    while(s.count(center) && center <= n) center++;
    //cout << " ** " << endl;
    vector<pair<int,int> >edges;
    edges.push_back({a[0],center});
    vector<int>v;
    for(int i = 1; i <= n; i++)
    {
        if(i != a[0] && i != center)
        {
            v.push_back(i);
            edges.push_back({i, center});
        }
    }
    for(int i = 0; i < v.size() && edges.size() < m ; i++)
    {
        for(int j = i+1; j < v.size() && edges.size() < m; j++)
        {
            edges.push_back({v[i], v[j]});
        }
    }
    for(int i = 1; i <= n && edges.size() < m; i++)
    {
        if(i == center || marked[a[i]] || i == a[0])
            continue;
        edges.push_back({a[0], i});
    }
    if(edges.size() < m || k == n)
    {
        puts("-1");
        return 0;
    }

    assert(edges.size() == m);
    for(auto &x : edges)
    {
        printf("%d %d\n",x.first,x.second);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int a[100005];
int marked[1000005];

int main()
{
    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);
    set<int>s;
    for(int i = 0; i < k; i++)
    {
        scanf("%d",&a[i]);
        s.insert(a[i]);
        marked[a[i]] = 1;
    }
    int center = 1;
    while(s.count(center) && center <= n) center++;
    //cout << " ** " << endl;
    vector<pair<int,int> >edges;
    edges.push_back({a[0],center});
    vector<int>v;
    for(int i = 1; i <= n; i++)
    {
        if(i != a[0] && i != center)
        {
            v.push_back(i);
            edges.push_back({i, center});
        }
    }
    for(int i = 0; i < v.size() && edges.size() < m ; i++)
    {
        for(int j = i+1; j < v.size() && edges.size() < m; j++)
        {
            edges.push_back({v[i], v[j]});
        }
    }
    cout << edges.size() << endl;
    for(int i = 1; i <= n && edges.size() < m; i++)
    {
        if(i == center || marked[a[i]] || i == a[0])
            continue;
        edges.push_back({a[0], i});
    }
    if(edges.size() < m || k == n)
    {
        puts("-1");
        return 0;
    }

    assert(edges.size() == m);
    for(auto &x : edges)
    {
        printf("%d %d\n",x.first,x.second);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int a[100005];
int marked[1000005];

int main()
{
    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);
    set<int>s;
    for(int i = 0; i < k; i++)
    {
        scanf("%d",&a[i]);
        s.insert(a[i]);
        marked[a[i]] = 1;
    }
    int center = 1;
    while(s.count(center) && center <= n) center++;
    //cout << " ** " << endl;
    vector<pair<int,int> >edges;
    for(int i = 0; i < k; i++)
        edges.push_back({a[i], center});
    vector<int>v;
    for(int i = 1; i <= n; i++)
    {
        if(!marked[i] && i != center)
        {
            v.push_back(i);
            edges.push_back({i, center});
        }
    }
    for(int i = 0; i < v.size() && edges.size() < m ; i++)
    {
        for(int j = i+1; j < v.size() && edges.size() < m; j++)
        {
            edges.push_back({v[i], v[j]});
        }
    }

    if(edges.size() < m || k == n)
    {
        puts("-1");
        return 0;
    }
    assert(edges.size() == m);
    for(auto &x : edges)
    {
        printf("%d %d\n",x.first,x.second);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int a[100005];
int marked[1000005];

int main()
{
    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);
    set<int>s;
    for(int i = 0; i < k; i++)
    {
        scanf("%d",&a[i]);
        s.insert(a[i]);
        marked[a[i]] = 1;
    }
    int center = 1;
    while(s.count(center) && center <= n) center++;
    //cout << " ** " << endl;
    vector<pair<int,int> >edges;
    for(int i = 0; i < k; i++)
        edges.push_back({a[i], center});
    vector<int>v;
    for(int i = 1; i <= n; i++)
    {
        if(!marked[i])
        {
            v.push_back(i);
            edges.push_back({i, center});
        }
    }
    for(int i = 0; i < v.size() && edges.size() < m ; i++)
    {
        for(int j = i+1; j < v.size(); j++)
        {
            edges.push_back({v[i], v[j]});
        }
    }

    if(edges.size() < m || k == n)
    {
        puts("-1");
        return 0;
    }
    for(auto &x : edges)
    {
        printf("%d %d\n",x.first,x.second);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int a[100005];
int marked[1000005];

int main()
{
    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);
    set<int>s;
    for(int i = 0; i < k; i++)
    {
        scanf("%d",&a[i]);
        s.insert(a[i]);
        marked[a[i]] = 1;
    }
    int center = 1;
    while(s.count(center)) center++;
    //cout << " ** " << endl;
    vector<pair<int,int> >edges;
    for(int i = 0; i < k; i++)
        edges.push_back({a[i], center});
    vector<int>v;
    for(int i = 1; i <= n; i++)
    {
        if(!marked[i])
        {
            v.push_back(i);
        }
    }
    for(int i = 0; i < v.size() && edges.size() < m ; i++)
    {
        for(int j = i+1; j < v.size(); j++)
        {
            edges.push_back({v[i], v[j]});
        }
    }

    if(edges.size() < m || k == n)
    {
        puts("-1");
        return 0;
    }
    for(auto &x : edges)
    {
        printf("%d %d\n",x.first,x.second);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int a[100005];
int marked[1000005];

int main()
{
    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);
    set<int>s;
    for(int i = 0; i < k; i++)
    {
        scanf("%d",&a[i]);
        s.insert(a[i]);
        marked[a[i]] = 1;
    }
    int center = 1;
    while(s.count(center) && center <= n) center++;
    //cout << " ** " << endl;
    vector<pair<int,int> >edges;
    edges.push_back({a[0],center});
    vector<int>v;
    for(int i = 1; i <= n; i++)
    {
        if(i != a[0] && i != center)
        {
            v.push_back(i);
            edges.push_back({i, center});
        }
    }
    for(int i = 0; i < v.size() && edges.size() < m ; i++)
    {
        for(int j = i+1; j < v.size() && edges.size() < m; j++)
        {
            edges.push_back({v[i], v[j]});
        }
    }
    for(int i = 1; i <= n && edges.size() < m; i++)
    {
        if(i == center || marked[i]  || i == a[0])
            continue;
        edges.push_back({a[0], i});
    }
    if(edges.size() < m || k == n)
    {
        puts("-1");
        return 0;
    }

    assert(edges.size() == m);
    for(auto &x : edges)
    {
        printf("%d %d\n",x.first,x.second);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int a[100005];
int marked[1000005];

int main()
{
    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);
    set<int>s;
    for(int i = 0; i < k; i++)
    {
        scanf("%d",&a[i]);
        s.insert(a[i]);
        marked[a[i]] = 1;
    }
    int center = 1;
    while(s.count(center) && center <= n) center++;
    //cout << " ** " << endl;
    vector<pair<int,int> >edges;
    for(int i = 0; i < k; i++)
        edges.push_back({a[i], center});
    vector<int>v;
    for(int i = 1; i <= n; i++)
    {
        if(!marked[i] && i != center)
        {
            v.push_back(i);
            edges.push_back({i, center});
        }
    }
    for(int i = 0; i < v.size() && edges.size() < m ; i++)
    {
        for(int j = i+1; j < v.size(); j++)
        {
            edges.push_back({v[i], v[j]});
        }
    }

    if(edges.size() < m || k == n)
    {
        puts("-1");
        return 0;
    }
    for(auto &x : edges)
    {
        printf("%d %d\n",x.first,x.second);
    }

    return 0;
}


/*
 *Author - Abhas Jain
 */

#include <bits/stdc++.h>

#define F first
#define S second
#define all(c) c.begin(), c.end()
#define endl '\n'
#define pb push_back
#define mp make_pair
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;
typedef long double ld;

using namespace std;
using namespace __gnu_pbds;
template <typename A, typename B>
string to_string(pair<A, B> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef AJ47
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

const ld PI = 3.141592653589793;
const ll INF = 9223372036854775807ll;
const ll mod = 1e9 + 7;

void solve()
{
	int n, m, k;
	cin >> n >> m >> k;
	if (k == n) {
		cout << -1 << endl;
		return;
	}
	vector<int> marked;
	vector<vector<int>> done(n + 1, vector<int> (n + 1, 0));
	vector<pair<int, int>> pr;
	for (int i = 0; i < k; ++i) {
		int vertex;
		cin >> vertex;
		marked.pb(vertex);
	}
	for (int i = 1; i <= n; ++i) {
		if (find(all(marked), i) == marked.end()) {
			for (int j = 1; j <= n; ++j) {
				if (m && i != j && !done[min(i, j)][max(i, j)]) {
					pr.pb({min(i, j), max(i, j)});
					m--;
					done[min(i, j)][max(i, j)] = 1;
				}
			}
		}
	}
	for (int i = 2; i < k; ++i) {
		for (int j = i + 1; j < k; ++j) {
			if (m) {
				m--;
				pr.pb({marked[i], marked[j]});
			}
		}
	}
	for (int i = 2; i < k; ++i) {
		if (m) {
			m--;
			pr.pb({marked[0], marked[i]});
		}
	}
	if (m) cout << -1 << endl;
	else {
		for (auto cur : pr) {
			cout << cur.F << " " << cur.S << endl;
		}
	}
}

int main( )
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    solve();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int a[305];
int mark[305];
int dist1[305][305], dist2[305][305];
int n, m;

void floyd1() {
    for (int k = 1; k <= n; ++k) {
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                dist1[i][j] = min(dist1[i][j], dist1[i][k] + dist1[k][j]);
            }
        }
    }
}

int k;

void floyd2() {
    for (int v = 0; v < k; ++v) {
        int d = a[v];
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                dist2[i][j] = min(dist2[i][j], dist2[i][d] + dist2[d][j]);
            }
        }
    }
}

int main() {
  //  freopen("in.txt", "rt", stdin);

    scanf("%d %d %d", &n, &m, &k);
    for (int i = 0; i < k; ++i) {
        scanf("%d", a + i);
        mark[a[i]] = 1;
    }
    if (k == n) {
        puts("-1");
        return 0;
    }

    int x = -1;
    for (int i = 1; i <= n; ++i) {
        if (!mark[i]) {
            mark[i] = 1;
            x = i;
            break;
        }
    }
    vector<pair<int, int>> vec;
    vector<int> nd;
    for (int i = 0; i < k; ++i) {
        nd.push_back(a[i]);
    }
    for (int i = 1; i <= n; ++i) {
        if (!mark[i]) nd.push_back(i);
    }
   // reverse(nd.begin(), nd.end());
    for (auto xx:nd) {
        vec.push_back({x, xx});
    }
    for (int i = 0; i < nd.size() && vec.size() < m; ++i) {
        for (int j = i + 1; j < nd.size(); ++j) {
            vec.push_back({nd[i], nd[j]});
        }
    }
    while (vec.size() > m) vec.pop_back();
    memset(dist1, '?', sizeof dist1);
    memset(dist2, '?', sizeof dist2);
    for (int i = 1; i <= n; ++i) {
        dist1[i][i] = dist2[i][i] = 0;
    }
    for (auto e:vec) {
        int a = e.first, b = e.second;
        dist1[a][b] = dist2[a][b] = dist1[b][a] = dist2[b][a] = 1;
    }
    floyd1();
    floyd2();
    bool c = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = i + 1; j <= n; ++j) {
            if (dist1[i][j] < dist2[i][j]) {
                c = 1;
                break;
            }
        }
    }
    if (!c) {
        puts("-1");
        return 0;
    }
    for (auto e:vec) printf("%d %d\n", e.first, e.second);
}


#include <bits/stdc++.h>

using namespace std;
int a[305];
int mark[305];
int dist1[305][305], dist2[305][305];
int n, m;

void floyd1() {
    for (int k = 1; k <= n; ++k) {
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                dist1[i][j] = min(dist1[i][j], dist1[i][k] + dist1[k][j]);
            }
        }
    }
}

int k;

void floyd2() {
    for (int v = 0; v < k; ++v) {
        int d = a[v];
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                dist2[i][j] = min(dist2[i][j], dist2[i][d] + dist2[d][j]);
            }
        }
    }
}

int main() {
    //  freopen("in.txt", "rt", stdin);

    scanf("%d %d %d", &n, &m, &k);
    for (int i = 0; i < k; ++i) {
        scanf("%d", a + i);
        mark[a[i]] = 1;
    }
    if (k == n) {
        puts("-1");
        return 0;
    }

    int x = -1;
    for (int i = 1; i <= n; ++i) {
        if (!mark[i]) {
            mark[i] = 1;
            x = i;
            break;
        }
    }
    vector<pair<int, int>> vec;
    vector<int> nd;
    for (int i = 0; i < k; ++i) {
        nd.push_back(a[i]);
    }
    for (int i = 1; i <= n; ++i) {
        if (!mark[i]) nd.push_back(i);
    }
    for (auto xx:nd) {
        vec.push_back({x, xx});
    }
    reverse(nd.begin(), nd.end());
    for (int i = 1; i < nd.size() && vec.size() < m; ++i) {
        for (int j = 0; j < i; ++j) {
            vec.push_back({nd[i], nd[j]});
        }
    }
    while (vec.size() > m) vec.pop_back();
    memset(dist1, '?', sizeof dist1);
    memset(dist2, '?', sizeof dist2);
    for (int i = 1; i <= n; ++i) {
        dist1[i][i] = dist2[i][i] = 0;
    }
    for (auto e:vec) {
        int a = e.first, b = e.second;
        dist1[a][b] = dist2[a][b] = dist1[b][a] = dist2[b][a] = 1;
    }
    floyd1();
    floyd2();
    bool c = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = i + 1; j <= n; ++j) {
            if (dist1[i][j] < dist2[i][j]) {
                c = 1;
                break;
            }
        }
    }
    if (!c) {
        puts("-1");
        return 0;
    }
    for (auto e:vec) printf("%d %d\n", e.first, e.second);
}


#include <bits/stdc++.h>

using namespace std;
int a[305];
int mark[305];
int dist1[305][305], dist2[305][305];
int n, m;

void floyd1() {
    for (int k = 1; k <= n; ++k) {
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                dist1[i][j] = min(dist1[i][j], dist1[i][k] + dist1[k][j]);
            }
        }
    }
}

int k;

void floyd2() {
    for (int v = 0; v < k; ++v) {
        int d = a[v];
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                dist2[i][j] = min(dist2[i][j], dist2[i][d] + dist2[d][j]);
            }
        }
    }
}

int main() {
  //  freopen("in.txt", "rt", stdin);

    scanf("%d %d %d", &n, &m, &k);
    for (int i = 0; i < k; ++i) {
        scanf("%d", a + i);
        mark[a[i]] = 1;
    }
    if (k == n) {
        puts("-1");
        return 0;
    }

    int x = -1;
    for (int i = 1; i <= n; ++i) {
        if (!mark[i]) {
            mark[i] = 1;
            x = i;
            break;
        }
    }
    vector<pair<int, int>> vec;
    vector<int> nd;
    for (int i = 0; i < k; ++i) {
        nd.push_back(a[i]);
    }
    for (int i = 1; i <= n; ++i) {
        if (!mark[i]) nd.push_back(i);
    }
    reverse(nd.begin(), nd.end());
    for (auto xx:nd) {
        vec.push_back({x, xx});
    }
    for (int i = 0; i < nd.size() && vec.size() < m; ++i) {
        for (int j = i + 1; j < nd.size(); ++j) {
            vec.push_back({nd[i], nd[j]});
        }
    }
    while (vec.size() > m) vec.pop_back();
    memset(dist1, '?', sizeof dist1);
    memset(dist2, '?', sizeof dist2);
    for (int i = 1; i <= n; ++i) {
        dist1[i][i] = dist2[i][i] = 0;
    }
    for (auto e:vec) {
        int a = e.first, b = e.second;
        dist1[a][b] = dist2[a][b] = dist1[b][a] = dist2[b][a] = 1;
    }
    floyd1();
    floyd2();
    bool c = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = i + 1; j <= n; ++j) {
            if (dist1[i][j] < dist2[i][j]) {
                c = 1;
                break;
            }
        }
    }
    if (!c) {
        puts("-1");
        return 0;
    }
    for (auto e:vec) printf("%d %d\n", e.first, e.second);
}


#include <bits/stdc++.h>

using namespace std;
int a[305];
int mark[305];
int dist1[305][305], dist2[305][305];
int n, m;

void floyd1() {
    for (int k = 1; k <= n; ++k) {
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                dist1[i][j] = min(dist1[i][j], dist1[i][k] + dist1[k][j]);
            }
        }
    }
}

int k;

void floyd2() {
    for (int v = 0; v < k; ++v) {
        int d = a[v];
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                dist2[i][j] = min(dist2[i][j], dist2[i][d] + dist2[d][j]);
            }
        }
    }
}

int main() {
    //  freopen("in.txt", "rt", stdin);

    scanf("%d %d %d", &n, &m, &k);
    for (int i = 0; i < k; ++i) {
        scanf("%d", a + i);
        mark[a[i]] = 1;
    }
    if (k == n) {
        puts("-1");
        return 0;
    }

    int x = -1;
    for (int i = 1; i <= n; ++i) {
        if (!mark[i]) {
            mark[i] = 1;
            x = i;
            break;
        }
    }
    vector<pair<int, int>> vec;
    vector<int> nd;
    for (int i = 0; i < k; ++i) {
        nd.push_back(a[i]);
    }
    for (int i = 1; i <= n; ++i) {
        if (!mark[i]) nd.push_back(i);
    }
    for (auto xx:nd) {
        vec.push_back({x, xx});
    }
    reverse(nd.begin(), nd.end());
    for (int i = 0; i < nd.size() && vec.size() < m; ++i) {
        for (int j = i + 1; j < nd.size(); ++j) {
            vec.push_back({nd[i], nd[j]});
        }
    }
    while (vec.size() > m) vec.pop_back();
    memset(dist1, '?', sizeof dist1);
    memset(dist2, '?', sizeof dist2);
    for (int i = 1; i <= n; ++i) {
        dist1[i][i] = dist2[i][i] = 0;
    }
    for (auto e:vec) {
        int a = e.first, b = e.second;
        dist1[a][b] = dist2[a][b] = dist1[b][a] = dist2[b][a] = 1;
    }
    floyd1();
    floyd2();
    bool c = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = i + 1; j <= n; ++j) {
            if (dist1[i][j] < dist2[i][j]) {
                c = 1;
                break;
            }
        }
    }
    if (!c) {
        puts("-1");
        return 0;
    }
    for (auto e:vec) printf("%d %d\n", e.first, e.second);
}


#include <bits/stdc++.h>

using namespace std;
int a[305];
int mark[305];
int dist1[305][305], dist2[305][305];
int n, m;

void floyd1() {
    for (int k = 1; k <= n; ++k) {
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                dist1[i][j] = min(dist1[i][j], dist1[i][k] + dist1[k][j]);
            }
        }
    }
}

int k;

void floyd2() {
    for (int v = 0; v < k; ++v) {
        int d = a[v];
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                dist2[i][j] = min(dist2[i][j], dist2[i][d] + dist2[d][j]);
            }
        }
    }
}

int main() {
    //  freopen("in.txt", "rt", stdin);

    scanf("%d %d %d", &n, &m, &k);
    for (int i = 0; i < k; ++i) {
        scanf("%d", a + i);
        mark[a[i]] = 1;
    }
    if (k == n) {
        puts("-1");
        return 0;
    }

    int x = -1;
    for (int i = 1; i <= n; ++i) {
        if (!mark[i]) {
            mark[i] = 1;
            x = i;
            break;
        }
    }
    vector<pair<int, int>> vec;
    vector<int> nd;
    for (int i = 0; i < k; ++i) {
        nd.push_back(a[i]);
    }
    for (int i = 1; i <= n; ++i) {
        if (!mark[i]) nd.push_back(i);
    }
    for (auto xx:nd) {
        vec.push_back({x, xx});
    }
    //reverse(nd.begin(), nd.end());
    for (int i = 1; i < nd.size() && vec.size() < m; ++i) {
        for (int j = 0; j < i; ++j) {
            vec.push_back({nd[i], nd[j]});
        }
    }
    while (vec.size() > m) vec.pop_back();
    memset(dist1, '?', sizeof dist1);
    memset(dist2, '?', sizeof dist2);
    for (int i = 1; i <= n; ++i) {
        dist1[i][i] = dist2[i][i] = 0;
    }
    for (auto e:vec) {
        int a = e.first, b = e.second;
        dist1[a][b] = dist2[a][b] = dist1[b][a] = dist2[b][a] = 1;
    }
    floyd1();
    floyd2();
    bool c = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = i + 1; j <= n; ++j) {
            if (dist1[i][j] < dist2[i][j]) {
                c = 1;
                break;
            }
        }
    }
    if (!c) {
        puts("-1");
        return 0;
    }
    for (auto e:vec) printf("%d %d\n", e.first, e.second);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<bool> vb;
typedef vector<string> vs;
const int di[] = { 0, 1 };
const int dj[] = { 1, 0 };
const ll MOD = 1e9 + 9;
const ll INF = 1e9;
const long double EPS = 1e-7;
#define all(n) n.begin(),n.end()

int n, m, k;
vb inA;
vi a, b;

bool test(vvi& adj) {
	vvi ans = adj;
	for (int i = 0; i < k; i++) {
		int v = a[i];
		for (int j = 0; j < n; j++)
			for (int r = 0; r < n; r++)
				ans[j][r] = min(ans[j][r], ans[j][v] + ans[v][r]);
	}

	vvi ans2 = adj;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++)
			for (int r = 0; r < n; r++)
				ans2[j][r] = min(ans2[j][r], ans2[j][i] + ans2[i][r]);
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (ans[i][j] != ans2[i][j])
				return true;
		}
	}
	return false;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m >> k;
	inA.resize(n);

	for (int i = 0; i < k; i++) {
		int x; cin >> x; x--;
		inA[x] = true;
		a.push_back(x);
	}
	for (int i = 0; i < n; i++) {
		if (!inA[i])
			b.push_back(i);
	}

	vvi adj(n, vi(n, INF));

	if (!b.empty()) for (int i = 1; (i < a.size() || i < b.size()) && m; i++) {
		if (i >= a.size())
			adj[b[0]][b[i]] = adj[b[i]][b[0]] = 1;
		else if (i >= b.size())
			adj[a[i]][b.back()] = adj[b.back()][a[i]] = 1;
		else
			adj[a[i]][b[i]] = adj[b[i]][a[i]] = 1;
		m--;
	}

	for (int i = 0; i < b.size() && m; i++) {
		for (int j = 0; j < a.size() && m; j++) {
			if (adj[a[j]][b[i]] != INF) continue;
			adj[a[j]][b[i]] = adj[b[i]][a[j]] = 1;
			m--;
		}
	}
	for (int i = 0; i < b.size() && m; i++) {
		for (int j = i + 1; j < b.size() && m; j++) {
			if (adj[b[j]][b[i]] != INF) continue;
			adj[b[j]][b[i]] = adj[b[i]][b[j]] = 1;
			m--;
		}
	}
	for (int i = 1; i < a.size() && m; i++) {
		for (int j = i + 1; j < a.size() && m; j++) {
			if (adj[a[j]][a[i]] != INF) continue;
			adj[a[j]][a[i]] = adj[a[i]][a[j]] = 1;
			m--;
		}
	}
	for (int i = 0; i < n && m; i++) {
		for (int j = i + 1; j < n && m; j++) {
			if (adj[i][j] != INF) continue;
			adj[i][j] = adj[j][i] = 1;
			m--;
		}
	}

	if (test(adj) && !m) {
		set<pii> st;
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				if (adj[i][j] != INF) {
					cout << i + 1 << " " << j + 1 << endl;
				}
			}
		}
	}
	else cout << -1 << endl;

	cin.ignore(), cin.get();
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<bool> vb;
typedef vector<string> vs;
const int di[] = { 0, 1 };
const int dj[] = { 1, 0 };
const ll MOD = 1e9 + 9;
const ll INF = 1e9;
const long double EPS = 1e-7;
#define all(n) n.begin(),n.end()

int n, m, k;
vb inA;
vi a, b;

bool test(vvi& adj) {
	vvi ans = adj;
	for (int i = 0; i < k; i++) {
		int v = a[i];
		for (int j = 0; j < n; j++)
			for (int r = 0; r < n; r++)
				ans[j][r] = min(ans[j][r], ans[j][v] + ans[v][r]);
	}

	vvi ans2 = adj;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++)
			for (int r = 0; r < n; r++)
				ans2[j][r] = min(ans2[j][r], ans2[j][i] + ans2[i][r]);
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (ans[i][j] != ans2[i][j])
				return true;
		}
	}
	return false;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m >> k;
	inA.resize(n);

	for (int i = 0; i < k; i++) {
		int x; cin >> x; x--;
		inA[x] = true;
		a.push_back(x);
	}
	for (int i = 0; i < n; i++) {
		if (!inA[i])
			b.push_back(i);
	}

	vvi adj(n, vi(n, INF));

	for (int i = 1; i < a.size() && i < b.size() && m; i++) {
		adj[a[i]][b[i]] = adj[b[i]][a[i]] = 1;
		m--;
	}
	for (int i = (int)b.size() - 1; i > 0; i--) {
		if (adj[b[i]][a.back()] != INF) break;
		adj[a.back()][b[i]] = adj[b[i]][a.back()] = 1;
		m--;
	}

	for (int i = 0; i < b.size() && m; i++) {
		for (int j = 0; j < a.size() && m; j++) {
			if (adj[a[j]][b[i]] != INF) continue;
			adj[a[j]][b[i]] = adj[b[i]][a[j]] = 1;
			m--;
		}
	}

	if (test(adj) && !m) {
		set<pii> st;
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				if (adj[i][j] != INF) {
					cout << i + 1 << " " << j + 1 << endl;
				}
			}
		}
	}
	else cout << -1 << endl;

	cin.ignore(), cin.get();
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<bool> vb;
typedef vector<string> vs;
const int di[] = { 0, 1 };
const int dj[] = { 1, 0 };
const ll MOD = 1e9 + 9;
const ll INF = 1e9;
const long double EPS = 1e-7;
#define all(n) n.begin(),n.end()

int n, m, k;
vb inA;
vi a, b;

bool test(vvi& adj) {
	vvi ans = adj;
	for (int i = 0; i < k; i++) {
		int v = a[i];
		for (int j = 0; j < n; j++)
			for (int r = 0; r < n; r++)
				ans[j][r] = min(ans[j][r], ans[j][v] + ans[v][r]);
	}

	vvi ans2 = adj;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++)
			for (int r = 0; r < n; r++)
				ans2[j][r] = min(ans2[j][r], ans2[j][i] + ans2[i][r]);
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (ans[i][j] != ans2[i][j])
				return true;
		}
	}
	return false;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m >> k;
	inA.resize(n);

	for (int i = 0; i < k; i++) {
		int x; cin >> x; x--;
		inA[x] = true;
		a.push_back(x);
	}
	for (int i = 0; i < n; i++) {
		if (!inA[i])
			b.push_back(i);
	}

	vvi adj(n, vi(n, INF));

	for (int i = 1; i < a.size() || i < b.size() && m; i++) {
		if (i >= a.size())
			adj[a.back()][b[i]] = adj[b[i]][a.back()] = 1;
		else if (i >= b.size())
			adj[a[i]][b.back()] = adj[b.back()][a[i]] = 1;
		else
			adj[a[i]][b[i]] = adj[b[i]][a[i]] = 1;
		m--;
	}

	for (int i = 0; i < b.size() && m; i++) {
		for (int j = 0; j < a.size() && m; j++) {
			if (adj[a[j]][b[i]] != INF) continue;
			adj[a[j]][b[i]] = adj[b[i]][a[j]] = 1;
			m--;
		}
	}

	if (test(adj) && !m) {
		set<pii> st;
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				if (adj[i][j] != INF) {
					cout << i + 1 << " " << j + 1 << endl;
				}
			}
		}
	}
	else cout << -1 << endl;

	cin.ignore(), cin.get();
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<bool> vb;
typedef vector<string> vs;
const int di[] = { 0, 1 };
const int dj[] = { 1, 0 };
const ll MOD = 1e9 + 9;
const ll INF = 1e9;
const long double EPS = 1e-7;
#define all(n) n.begin(),n.end()

int n, m, k;
vb inA;
vi a, b;

bool test(vvi& adj) {
	vvi ans = adj;
	for (int i = 0; i < k; i++) {
		int v = a[i];
		for (int j = 0; j < n; j++)
			for (int r = 0; r < n; r++)
				ans[j][r] = min(ans[j][r], ans[j][v] + ans[v][r]);
	}

	vvi ans2 = adj;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++)
			for (int r = 0; r < n; r++)
				ans2[j][r] = min(ans2[j][r], ans2[j][i] + ans2[i][r]);
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (ans[i][j] != ans2[i][j])
				return true;
		}
	}
	return false;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> m >> k;
	inA.resize(n);

	for (int i = 0; i < k; i++) {
		int x; cin >> x; x--;
		inA[x] = true;
		a.push_back(x);
	}
	for (int i = 0; i < n; i++) {
		if (!inA[i])
			b.push_back(i);
	}

	vvi adj(n, vi(n, INF));

	for (int i = 1; i < a.size() && i < b.size() && m; i++) {
		adj[a[i]][b[i]] = adj[b[i]][a[i]] = 1;
		m--;
	}
	for (int i = b.size() - 1; i >= 0; i--) {
		if (adj[b[i]][a.back()] != INF) break;
		adj[a.back()][b[i]] = adj[b[i]][a.back()] = 1;
		m--;
	}

	for (int i = 0; i < b.size() && m; i++) {
		for (int j = 0; j < a.size() && m; j++) {
			if (adj[a[j]][b[i]] != INF) continue;
			adj[a[j]][b[i]] = adj[b[i]][a[j]] = 1;
			m--;
		}
	}

	if (test(adj) && !m) {
		set<pii> st;
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				if (adj[i][j] != INF) {
					cout << i + 1 << " " << j + 1 << endl;
				}
			}
		}
	}
	else cout << -1 << endl;

	cin.ignore(), cin.get();
}