//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <stdio.h>
#include <bits/stdc++.h>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)

using namespace std;

inline void setmin(int &x, int y) { if (y < x) x = y; }
inline void setmax(int &x, int y) { if (y > x) x = y; }
inline void setmin(ll &x, ll y) { if (y < x) x = y; }
inline void setmax(ll &x, ll y) { if (y > x) x = y; }

const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

ll bin_pow(ll a, ll p)
{
    ll res = 1;
    while (p)
    {
        if (p & 1)
            res *= a;
        a *= a;
        p >>= 1;
    }
    return res;
}

int get(ll x)
{
    int cnt = 0;
    while (x > 0)
    {
        cnt++;
        x /= 10;
    }
    return cnt;
}

string to_s(ll n)
{
    string res;
    while (n > 0)
    {
        res += char('0' + n % 10);
        n /= 10;
    }
    reverse(res.begin(), res.end());
    return res;
}

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 0.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    ll n;
    cin >> n;
    if (n == 10000000000LL)
    {
        cout << "10^10\n";
        return 0;
    }
    vector<pair<pair<ll, ll>, pair<ll, int> > > good;
    for (ll x = 2; x * x <= n; x++)
    {
        ll cur = x;
        rep(pw, 2, 60)
        {
            cur *= x;
            if (cur > n)
                break;
            if (get(x) + 1 + get(pw) < get(cur))
                good.push_back({{x, pw}, {cur, get(x) + 1 + get(pw)}});
        }
    }
    //cout << sz(good) << "\n";
    sort(good.begin(), good.end(), [](auto a, auto b) { return a.se.fi < b.se.fi; });
    map<ll, string> mapa;
    rep(i, 0, sz(good))
        if (mapa.find(good[i].se.fi) == mapa.end() || good[i].se.se < sz(mapa[good[i].se.fi]))
            mapa[good[i].se.fi] = to_s(good[i].fi.fi) + "^" + to_s(good[i].fi.se);
    string ans = to_s(n);
    for (auto it : good)
    {
        ll v = it.se.fi;
        if (v > n)
            continue;

        if (v == n && it.se.se < sz(ans))
            ans = mapa[v];
        if (n % v == 0)
        {
            string tmp = to_s(n / v);
            if (mapa.find(n / v) != mapa.end())
                tmp = mapa[n / v];
            if (it.se.se + 1 + sz(tmp) < sz(ans))
                ans = mapa[v] + "*" + tmp;
        }
        if (v < n)
        {
            string tmp = to_s(n - v);
            if (mapa.find(n - v) != mapa.end())
                tmp = mapa[n - v];
            if (it.se.se + 1 + sz(tmp) < sz(ans))
                ans = mapa[v] + "+" + tmp;
        }

        for (ll mul = min(99LL, n / v); mul >= 2; mul--)
        {
            ll vv = v * mul;
            int len1 = mul >= 10 ? 2 : 1;
            if (vv < n)
            {
                ll rem = n - vv;
                string tmp = to_s(rem);
                if (mapa.find(rem) != mapa.end())
                    tmp = mapa[rem];
                if (it.se.se + 1 + len1 + 1 + sz(tmp) < sz(ans))
                    ans = mapa[v] + "*" + to_s(mul) + "+" + tmp;
            }
        }
        for (ll del = 1; del < 10; del++)
        {
            ll rem = n - del;
            if (rem > 0 && rem % v == 0)
            {
                string tmp = to_s(rem / v);
                if (mapa.find(rem / v) != mapa.end())
                    tmp = mapa[rem / v];
                if (it.se.se + 1 + sz(tmp) + 1 + 1 < sz(ans))
                    ans = mapa[v] + "*" + tmp + "+" + to_s(del);
            }
        }
        for (ll del = 2; del < 10; del++)
            if (n % del == 0 && n / del % v == 0)
            {
                ll v1 = n / del / v;
                if (mapa.find(v1) != mapa.end())
                {
                    string tmp = mapa[v1];
                    if (it.se.se + 1 + sz(tmp) + 1 + 1 < sz(ans))
                        ans = mapa[v] + "*" + tmp + "*" + to_s(del);
                }
            }
    }
    cout << ans << "\n";
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
using namespace std;

typedef long long int64;

const int INF = 0x3f3f3f3f;

map<int64,string> exps;

int declen(int64 x){
    int ret = 0;
    while(x > 0){
        x /= 10;
        ret++;
    }
    return ret;
}

int main(){
    int64 n;
    cin >> n;
    string ans = to_string(n);
    //clog << anslen << endl;
    for(int64 i = 2;i*i <= n;i++){
        int64 now = i;
        for(int j = 2;now * i <= n;j++){
        	//clog << i << ' ' << j << endl;
            now *= i;
            string tmp = to_string(i) + '^' + to_string(j);
            if(exps.find(now) == exps.end() || exps[now].length() > tmp.length()){
            	if(tmp.length() < declen(now)){
            		exps[now] = tmp;
            	}
            }
        }
    }
    for(auto i : exps){
    	int64 mul = n / i.first;
    	string Mul = (mul > 1)?(((exps.find(mul) != exps.end())?(exps[mul]):to_string(mul)) + "*"):("");
    	int64 add = n % i.first;
    	string Add = (add > 0)?("+" + ((exps.find(add) != exps.end())?(exps[add]):to_string(add))):("");
    	string tmp = Mul + (i.second) + Add;
    	if(tmp.length() < ans.length()){
    		ans = tmp;
    	}
    }
    cout << ans << endl;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
using namespace std;

typedef long long int64;

const int INF = 0x3f3f3f3f;

map<int64,string> exps;

string to_string(int64 n){
    int m = n;
    char s[20];
    char ss[20];
    int i = 0,j = 0;
    while (m > 0) {
        s[i++] = m % 10 + '0';
        m /= 10;
    }
    s[i] = '\0';
    i = i - 1;
    while (i >= 0) {
        ss[j++] = s[i--];
    }
    ss[j] = '\0';
    return ss;
}

int declen(int64 x){
    int ret = 0;
    while(x > 0){
        x /= 10;
        ret++;
    }
    return ret;
}

int main(){
    int64 n;
    cin >> n;
    string ans = to_string(n);
    //clog << anslen << endl;
    for(int64 i = 2;i*i <= n;i++){
        int64 now = i;
        for(int j = 2;now * i <= n;j++){
        	//clog << i << ' ' << j << endl;
            now *= i;
            string tmp = to_string(i) + '^' + to_string(j);
            if(exps.find(now) == exps.end() || exps[now].length() > tmp.length()){
            	if(tmp.length() < declen(now)){
            		exps[now] = tmp;
            	}
            }
        }
    }
    for(auto i : exps){
    	int64 mul = n / i.first;
    	string Mul = (mul > 1)?(((exps.find(mul) != exps.end())?(exps[mul]):to_string(mul)) + "*"):("");
    	int64 add = n % i.first;
    	string Add = (add > 0)?("+" + ((exps.find(add) != exps.end())?(exps[add]):to_string(add))):("");
    	string tmp = Mul + (i.second) + Add;
    	if(tmp.length() < ans.length()){
    		ans = tmp;
    	}
    }
    cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
long long n,p[10] = {1};
set<long long>st[10];
map<long long,string>mp;
string ans;
string tostring(long long x){
	string ret = "";
	while(x){
		ret+=x%10 + '0';
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string get(long long x){
	if(!mp.count(x))return tostring(x);
	return mp[x];
}
void fixans(string s){if(s.size() < ans.size())ans = s;}
void fix(long long x,string s){
	if(x > n || get(x).size() <= s.size())return;
	st[get(x).size()].erase(x);
	st[s.size()].insert(x);
	mp[x] = s;
}
int main() {
// 	freopen("readin.txt","r",stdin);
	for(int i = 1;i < 10;i++)p[i] = 10*p[i - 1];
	scanf("%lld",&n);
	for(long long i = 2;i*i <= n;i++){
		long long d = i;
		int p = 1;
		while(d*i <= n){
			d*=i;
			p++;
			fix(d,tostring(i) + "^" + tostring(p));
		}
	}
	for(int a = 1;a < 7;a++)
		for(int b = a;b + a - 1 < 7;b++)
			for(auto i : st[a])
				for(auto j : st[b])
					fix(i*j,get(i) + "*" + get(j));
	for(int a = 1;a < 7;a++)
		for(int b = 1;b < p[7 - a - 1];b++)
			for(auto i : st[a])fix(i*b,get(i) + "*" + get(b));
	ans = get(n);
	for(int i = 1;2*i + 1 < ans.size();i++){
		for(int j = 1;j < p[i];j++){
			if(j >= n)break;
			fixans(get(n - j) + "+" + get(j));
			if(n%j == 0)fixans(get(n/j) + "*" + get(j));
		}
		for(auto j : st[i]){
			fixans(get(n - j) + "+" + get(j));
			if(n%j == 0)fixans(get(n/j) + "*" + get(j));
		}
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
long long n,p[10] = {1};
set<long long>st[10];
map<long long,string>mp;
string ans;
string tostring(long long x){
	string ret = "";
	while(x){
		ret+=x%10 + '0';
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string get(long long x){
	if(!mp.count(x))return tostring(x);
	return mp[x];
}
void fixans(string s){if(s.size() < ans.size())ans = s;}
void fix(long long x,string s){
	if(x > n || get(x).size() <= s.size())return;
	st[get(x).size()].erase(x);
	st[s.size()].insert(x);
	mp[x] = s;
}
int main() {
// 	freopen("readin.txt","r",stdin);
	for(int i = 1;i < 10;i++)p[i] = 10*p[i - 1];
	scanf("%lld",&n);
	for(long long i = 2;i*i <= n;i++){
		long long d = i;
		int p = 1;
		while((d*i*1.0) <= n){
			d*=i;
			p++;
			fix(d,tostring(i) + "^" + tostring(p));
		}
	}
	for(int a = 1;a < 7;a++)
		for(int b = a;b + a - 1 < 7;b++)
			for(auto i : st[a])
				for(auto j : st[b])
					fix(i*j,get(i) + "*" + get(j));
	for(int a = 1;a < 7;a++)
		for(int b = 1;b < p[7 - a - 1];b++)
			for(auto i : st[a])fix(i*b,mp[i] + "*" + tostring(b));
	ans = get(n);
	for(int i = 1;2*i + 1 < ans.size();i++){
		for(int j = 1;j < p[i];j++){
			if(j >= n)break;
			fixans(tostring(n - j) + "+" + tostring(j));
			if(n%j == 0)fixans(tostring(n/j) + "+" + tostring(j));
		}
		for(auto j : st[i]){
			fixans(tostring(n - j) + "+" + mp[j]);
			if(n%j == 0)fixans(tostring(n/j) + "+" + tostring(j));
		}
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
long long n,p[10] = {1};
set<long long>st[10];
map<long long,string>mp;
string ans;
string tostring(long long x){
	string ret = "";
	while(x){
		ret+=x%10 + '0';
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string get(long long x){
	if(!mp.count(x))return tostring(x);
	return mp[x];
}
void fixans(string s){if(s.size() < ans.size())ans = s;}
void fix(long long x,string s){
	if(x > n || get(x).size() <= s.size())return;
	st[get(x).size()].erase(x);
	st[s.size()].insert(x);
	mp[x] = s;
}
int main() {
// 	freopen("readin.txt","r",stdin);
	for(int i = 1;i < 10;i++)p[i] = 10*p[i - 1];
	scanf("%lld",&n);
	for(long long i = 2;i*i <= n;i++){
		long long d = i;
		int p = 1;
		while((d*i*1.0) <= n){
			d*=i;
			p++;
			fix(d,tostring(i) + "^" + tostring(p));
		}
	}
	for(int a = 1;a < 7;a++)
		for(int b = a;b + a - 1 < 7;b++)
			for(auto i : st[a])
				for(auto j : st[b])
					fix(i*j,get(i) + "*" + get(j));
	for(int a = 1;a < 7;a++)
		for(int b = 1;b < p[7 - a - 1];b++)
			for(auto i : st[a])fix(i*b,mp[i] + "*" + tostring(b));
	ans = get(n);
	for(int i = 1;2*i + 1 < ans.size();i++){
		for(int j = 1;j < p[i];j++){
			if(j >= n)break;
			fixans(tostring(n - j) + "+" + tostring(j));
			if(n%j == 0)fixans(tostring(n/j) + "*" + tostring(j));
		}
		for(auto j : st[i]){
			fixans(tostring(n - j) + "+" + mp[j]);
			if(n%j == 0)fixans(tostring(n/j) + "*" + mp[j]);
		}
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
long long n,p[10] = {1};
set<long long>st[10];
map<long long,string>mp;
string ans;
string tostring(long long x){
	string ret = "";
	while(x){
		ret+=x%10 + '0';
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string get(long long x){
	if(!mp.count(x))return tostring(x);
	return mp[x];
}
void fixans(string s){if(s.size() < ans.size())ans = s;}
void fix(long long x,string s){
	if(x > n || get(x).size() <= s.size())return;
	st[get(x).size()].erase(x);
	st[s.size()].insert(x);
	mp[x] = s;
}
int main() {
// 	freopen("readin.txt","r",stdin);
	for(int i = 1;i < 10;i++)p[i] = 10*p[i - 1];
	scanf("%lld",&n);
	for(long long i = 2;i*i <= n;i++){
		long long d = i;
		int p = 1;
		while((d*i*1.0) <= n){
			d*=i;
			p++;
			fix(d,tostring(i) + "^" + tostring(p));
		}
	}
	for(int a = 1;a < 7;a++)
		for(int b = a;b + a - 1 < 7;b++)
			for(auto i : st[a])
				for(auto j : st[b])
					fix(i*j,get(i) + "*" + get(j));
	for(int a = 1;a < 7;a++)
		for(int b = 1;b < p[7 - a - 1];b++)
			for(auto i : st[a])fix(i*b,mp[i] + "*" + tostring(b));
	ans = get(n);
	for(int i = 1;2*i + 1 < ans.size();i++){
		for(int j = 1;j < p[i];j++){
			if(j >= n)break;
			fixans(tostring(n - j) + "+" + tostring(j));
			if(n%j == 0)fixans(tostring(n/j) + "+" + tostring(j));
		}
		for(auto j : st[i]){
			fixans(tostring(n - j) + "+" + mp[j]);
			if(n%j == 0)fixans(tostring(n/j) + "+" + mp[j]);
		}
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>
using namespace std;
long long n,p[10] = {1};
set<long long>st[10];
map<long long,string>mp;
string ans;
string tostring(long long x){
	string ret = "";
	while(x){
		ret+=x%10 + '0';
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string get(long long x){
	if(!mp.count(x))return tostring(x);
	return mp[x];
}
void fixans(string s){if(s.size() < ans.size())ans = s;}
void fix(long long x,string s){
	if(x > n || get(x).size() <= s.size())return;
	st[get(x).size()].erase(x);
	st[s.size()].insert(x);
	mp[x] = s;
}
int main() {
// 	freopen("readin.txt","r",stdin);
	for(int i = 1;i < 10;i++)p[i] = 10*p[i - 1];
	scanf("%lld",&n);
	for(long long i = 2;i*i <= n;i++){
		long long d = i;
		int p = 1;
		while(d*i*1.0 <= n){
			d*=i;
			p++;
			fix(d,tostring(i) + "^" + tostring(p));
		}
	}
	for(int a = 1;a < 7;a++)
		for(int b = a;b + a - 1 < 7;b++)
			for(auto i : st[a])
				for(auto j : st[b])
					fix(i*j,get(i) + "*" + get(j));
	for(int a = 1;a < 7;a++)
		for(int b = 1;b < p[7 - a - 1];b++)
			for(auto i : st[a])fix(i*b,get(i) + "*" + get(b));
	ans = get(n);
	for(int i = 1;2*i + 1 < ans.size();i++){
		for(int j = 1;j < p[i];j++){
			if(j >= n)break;
			fixans(get(n - j) + "+" + get(j));
			if(n%j == 0)fixans(get(n/j) + "*" + get(j));
		}
		for(auto j : st[i]){
			fixans(get(n - j) + "+" + get(j));
			if(n%j == 0)fixans(get(n/j) + "*" + get(j));
		}
	}
	cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n,p[10];
map<LL,string>m;
set<LL>s[10];

template <class T> string toString(T x){
    ostringstream os;
    os<<x;
    return os.str();
}

int getlen(LL x){
    int ans=0;
    while(x){ans++;x/=10;}
    return max(ans,1);
}

string get(LL x){
    if(m.count(x))return m[x];
    return toString(x);
}

void relaxPower(LL x,string str){
    if(x>n||str.length()>=getlen(x))return;
    if(m.count(x)&&m[x].length()<=str.length())return;
    s[m[x].length()].erase(x);
    m[x]=str;
    s[str.length()].insert(x);
}

void getPowers(){
    for(LL x=2;x*x<=n;x++){
        LL rs=x*x;
        int p=2;
        while(rs<=n){
            string tmp=toString(x)+'^'+toString(p);
            relaxPower(rs,tmp);
            rs*=x;p++;
        }
    }
}

void getPowerAndPower(int len){
    for(int i=1;i<=len;i++)
        for(int j=i;i+j+1<=len;j++)
            for(auto x:s[i])
                for(auto y:s[j])
                    relaxPower(x*y,get(x)+'*'+get(y));
}

void getSimpleAndPower(int len){
    for(int i=1;i+2<=len;i++){
        for(LL x=1;x<p[len-i-1];x++)
            for(LL y:s[i])
                relaxPower(x*y,toString(x)+'*'+get(y));
    }
}

void precalc(){
    getPowers();
    getPowerAndPower(7);
    getSimpleAndPower(7);
}

string ans;
void relaxAnswer(string str){
    if(str.length()<ans.length())ans=str;
}

void checkAnswer(){
    for(int i=1;i*2+1<ans.length();i++){
        for(LL x=1;x<=p[i];x++){
            relaxAnswer(get(n-x)+'+'+get(x));
            if(n%x==0)relaxAnswer(get(n/x)+'*'+get(x));
        }
        for(auto x:s[i]){
            relaxAnswer(get(n-x)+'+'+get(x));
            if(n%x==0)relaxAnswer(get(n/x)+'*'+get(x));
        }
    }
}

int main(){
    p[0]=1;
    for(int i=1;i<10;i++)p[i]=p[i-1]*10;
    cin>>n;
    precalc();
    ans=get(n);
    checkAnswer();
    cout<<ans<<endl;
}


#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#define mod 1000000007
#define inf 1000000000
#define siz 975
using namespace std;
int n,m,k;
int a[303];
bool used[303];
struct ans
{
    int x,y;
};
ans b[100003];
int coun;

int main()
{
    scanf("%d %d %d",&n,&m,&k);
    int i,j;
    for(i=0;i<k;i++)
    {
        scanf("%d",&a[i]);
        used[a[i]]=true;
    }
    if(k==n)
    {
        printf("-1\n");
        return 0;
    }
    int bad=1;
    for(i=1;i<=n;i++)
        if(!used[i])
        {
            bad=i;
            for(j=1;j<=n;j++)
            {
                if(j!=i)
                {
                    b[coun].x=i;
                    b[coun++].y=j;
                }
            }
            break;
        }
    for(i=1;i<=n;i++)
        for(j=i+1;j<=n;j++)
        {
            if(i!=bad && j!=bad)
            {
                if(!used[i] || !used[j])
                {
                    b[coun].x=i;
                    b[coun++].y=j;
                }
                else if(i!=a[0] && j!=a[0])
                {
                    b[coun].x=i;
                    b[coun++].y=j;
                }
            }
        }
    if(coun<m)
    {
        printf("-1\n");
        return 0;
    }
    for(i=0;i<m;i++)
        printf("%d %d\n",b[i].x,b[i].y);
    return 0;
}
/*

 */


#include<iostream>
#include<cstdio>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<assert.h>
#include<ctime>
#include<bitset>
#include<numeric>
#include<complex>
using namespace std;
#define double long double
#define foreach(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define foR(i,a,n) for(register int i=(a);i<(int)(n);++i)
#define foeE(i,a,n) for(i=(a);i<(int)(n);++i)
#define Size(n) ((int)(n).size())
#define all(n) (n).begin(), (n).end()
#define ll long long
#define pb push_back
#define error(x) cout << #x << " = " << (x) << endl;
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define point complex<double>
//#define X real()
//#define Y imag()
#define X first
#define Y second
//#define endl "\n"
#define pdd pair<double, double>
#define mkp make_pair
const ll maxn=1000;
const double inf=1e18,eps=1e-9,PI=4*atan(1);
int arr[maxn];
bool mark[maxn],c[maxn][maxn];
int main(){
	ios::sync_with_stdio(false);
	int n,m,k;
	cin>>n>>m>>k;
	foR(i,0,k){
		cin>>arr[i];
		mark[arr[i]]=true;
	}
	if(k==n||m>n*(n-1)/2-(k+1)){
		cout<<-1<<endl;
		return 0;
	}
	int a=arr[0],b=arr[1];
	foR(i,2,k){
		cout<<a<<' '<<arr[i]<<endl;
		c[a][arr[i]]=true;
		c[arr[i]][a]=true;
		m--;
	}
	foR(i,1,n+1)
		if(!mark[i]){
			cout<<a<<' '<<i<<endl;
			c[a][i]=c[i][a]=true;
			m--;if(!m)return 0;
			cout<<b<<' '<<i<<endl;
			c[b][i]=c[i][b]=true;
			m--;if(!m)return 0;
		}
	foR(i,1,n+1)
		foR(j,i+1,n+1)
		if(i!=b&&j!=b&&!c[i][j]){
			cout<<i<<' '<<j<<endl;
			c[i][j]=c[j][i]=true;
			m--;if(!m)return 0;
		}

	return 0;
}


#include<iostream>
#include<cstdio>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<assert.h>
#include<ctime>
#include<bitset>
#include<numeric>
#include<complex>
using namespace std;
#define double long double
#define foreach(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define foR(i,a,n) for(register int i=(a);i<(int)(n);++i)
#define foeE(i,a,n) for(i=(a);i<(int)(n);++i)
#define Size(n) ((int)(n).size())
#define all(n) (n).begin(), (n).end()
#define ll long long
#define pb push_back
#define error(x) cout << #x << " = " << (x) << endl;
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define point complex<double>
//#define X real()
//#define Y imag()
#define X first
#define Y second
//#define endl "\n"
#define pdd pair<double, double>
#define mkp make_pair
const ll maxn=1000;
const double inf=1e18,eps=1e-9,PI=4*atan(1);
int arr[maxn];
bool mark[maxn],c[maxn][maxn];
int main(){
	ios::sync_with_stdio(false);
	int n,m,k;
	cin>>n>>m>>k;
	foR(i,0,k){
		cin>>arr[i];
		mark[arr[i]]=true;
	}
	if(k==n||m>n*(n-1)/2-(k-1)){
		cout<<-1<<endl;
		return 0;
	}
	int a=arr[0],b=arr[1];
	foR(i,1,n+1){
		if(i!=a&&i!=b){
			cout<<a<<' '<<i<<endl;
			c[a][i]=c[i][a]=true;
			m--;
		}
	}
	foR(i,1,n+1)
		if(!mark[i]){
			if(!c[i][b]){
				cout<<b<<' '<<i<<endl;
				c[b][i]=c[i][b]=true;
				m--;if(!m)return 0;
			}
		}
	foR(i,1,n+1)
		foR(j,i+1,n+1)
		if(i!=b&&j!=b&&!c[i][j]){
			cout<<i<<' '<<j<<endl;
			c[i][j]=c[j][i]=true;
			m--;if(!m)return 0;
		}

	return 0;
}


#include<iostream>
#include<cstdio>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<assert.h>
#include<ctime>
#include<bitset>
#include<numeric>
#include<complex>
using namespace std;
#define double long double
#define foreach(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define foR(i,a,n) for(register int i=(a);i<(int)(n);++i)
#define foeE(i,a,n) for(i=(a);i<(int)(n);++i)
#define Size(n) ((int)(n).size())
#define all(n) (n).begin(), (n).end()
#define ll long long
#define pb push_back
#define error(x) cout << #x << " = " << (x) << endl;
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define point complex<double>
//#define X real()
//#define Y imag()
#define X first
#define Y second
//#define endl "\n"
#define pdd pair<double, double>
#define mkp make_pair
const ll maxn=1000;
const double inf=1e18,eps=1e-9,PI=4*atan(1);
int arr[maxn];
bool mark[maxn],c[maxn][maxn];
int main(){
	ios::sync_with_stdio(false);
	int n,m,k;
	cin>>n>>m>>k;
	foR(i,0,k){
		cin>>arr[i];
		mark[arr[i]]=true;
	}
	if(m>n*(n-1)/2-(k-1)){
		cout<<-1<<endl;
		return 0;
	}
	int a=arr[0],b=arr[1];
	foR(i,2,k){
		cout<<a<<' '<<arr[i]<<endl;
		c[a][arr[i]]=true;
		c[arr[i]][a]=true;
		m--;
	}
	foR(i,1,n+1)
		if(!mark[i]){
			cout<<a<<' '<<i<<endl;
			c[a][i]=c[i][a]=true;
			m--;if(!m)return 0;
			cout<<b<<' '<<i<<endl;
			c[b][i]=c[i][b]=true;
			m--;if(!m)return 0;
		}
	foR(i,1,n+1)
		foR(j,i+1,n+1)
		if(i!=b&&j!=b&&!c[i][j]){
			cout<<i<<' '<<j<<endl;
			c[i][j]=c[j][i]=true;
			m--;if(!m)return 0;
		}

	return 0;
}


#include<iostream>
#include<cstdio>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<assert.h>
#include<ctime>
#include<bitset>
#include<numeric>
#include<complex>
using namespace std;
#define double long double
#define foreach(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define foR(i,a,n) for(register int i=(a);i<(int)(n);++i)
#define foeE(i,a,n) for(i=(a);i<(int)(n);++i)
#define Size(n) ((int)(n).size())
#define all(n) (n).begin(), (n).end()
#define ll long long
#define pb push_back
#define error(x) cout << #x << " = " << (x) << endl;
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define point complex<double>
//#define X real()
//#define Y imag()
#define X first
#define Y second
//#define endl "\n"
#define pdd pair<double, double>
#define mkp make_pair
const ll maxn=1000;
const double inf=1e18,eps=1e-9,PI=4*atan(1);
int arr[maxn];
bool mark[maxn],c[maxn][maxn];
int main(){
	ios::sync_with_stdio(false);
	int n,m,k;
	cin>>n>>m>>k;
	foR(i,0,k){
		cin>>arr[i];
		mark[arr[i]]=true;
	}
	if(k==n||m>n*(n-1)/2-(k-1)){
		cout<<-1<<endl;
		return 0;
	}
	int a=arr[0],b=arr[1];
	foR(i,1,n+1){
		if(i!=a&&i!=b){
			cout<<a<<' '<<i<<endl;
			c[a][arr[i]]=true;
			c[arr[i]][a]=true;
			m--;
		}
	}
	foR(i,1,n+1)
		if(!mark[i]){
			cout<<b<<' '<<i<<endl;
			c[b][i]=c[i][b]=true;
			m--;if(!m)return 0;
		}
	foR(i,1,n+1)
		foR(j,i+1,n+1)
		if(i!=b&&j!=b&&!c[i][j]){
			cout<<i<<' '<<j<<endl;
			c[i][j]=c[j][i]=true;
			m--;if(!m)return 0;
		}

	return 0;
}


#include<iostream>
#include<cstdio>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<assert.h>
#include<ctime>
#include<bitset>
#include<numeric>
#include<complex>
using namespace std;
#define double long double
#define foreach(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define foR(i,a,n) for(register int i=(a);i<(int)(n);++i)
#define foeE(i,a,n) for(i=(a);i<(int)(n);++i)
#define Size(n) ((int)(n).size())
#define all(n) (n).begin(), (n).end()
#define ll long long
#define pb push_back
#define error(x) cout << #x << " = " << (x) << endl;
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define point complex<double>
//#define X real()
//#define Y imag()
#define X first
#define Y second
//#define endl "\n"
#define pdd pair<double, double>
#define mkp make_pair
const ll maxn=1000;
const double inf=1e18,eps=1e-9,PI=4*atan(1);
int arr[maxn];
bool mark[maxn],c[maxn][maxn];
int main(){
	ios::sync_with_stdio(false);
	int n,m,k;
	cin>>n>>m>>k;
	foR(i,0,k){
		cin>>arr[i];
		mark[arr[i]]=true;
	}
	if(k==n||m>n*(n-1)/2-(k-1)){
		cout<<-1<<endl;
		return 0;
	}
	int a=arr[0],b=arr[1];
	foR(i,1,n+1){
		if(i!=a&&i!=b){
			cout<<a<<' '<<arr[i]<<endl;
			c[a][arr[i]]=true;
			c[arr[i]][a]=true;
			m--;
		}
	}
	foR(i,1,n+1)
		if(!mark[i]){
			cout<<b<<' '<<i<<endl;
			c[b][i]=c[i][b]=true;
			m--;if(!m)return 0;
		}
	foR(i,1,n+1)
		foR(j,i+1,n+1)
		if(i!=b&&j!=b&&!c[i][j]){
			cout<<i<<' '<<j<<endl;
			c[i][j]=c[j][i]=true;
			m--;if(!m)return 0;
		}

	return 0;
}


#include<iostream>
#include<cstdio>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<queue>
#include<stack>
#include<deque>
#include<assert.h>
#include<ctime>
#include<bitset>
#include<numeric>
#include<complex>
using namespace std;
#define double long double
#define foreach(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define foR(i,a,n) for(register int i=(a);i<(int)(n);++i)
#define foeE(i,a,n) for(i=(a);i<(int)(n);++i)
#define Size(n) ((int)(n).size())
#define all(n) (n).begin(), (n).end()
#define ll long long
#define pb push_back
#define error(x) cout << #x << " = " << (x) << endl;
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define point complex<double>
//#define X real()
//#define Y imag()
#define X first
#define Y second
//#define endl "\n"
#define pdd pair<double, double>
#define mkp make_pair
const ll maxn=1000;
const double inf=1e18,eps=1e-9,PI=4*atan(1);
int arr[maxn];
bool mark[maxn],c[maxn][maxn];
int main(){
	ios::sync_with_stdio(false);
	int n,m,k;
	cin>>n>>m>>k;
	foR(i,0,k){
		cin>>arr[i];
		mark[arr[i]]=true;
	}
	if(k==n||m>n*(n-1)/2-(k-1)){
		cout<<-1<<endl;
		return 0;
	}
	int a=arr[0],b=arr[1];
	foR(i,2,k){
		cout<<a<<' '<<arr[i]<<endl;
		c[a][arr[i]]=true;
		c[arr[i]][a]=true;
		m--;
	}
	foR(i,1,n+1)
		if(!mark[i]){
			cout<<a<<' '<<i<<endl;
			c[a][i]=c[i][a]=true;
			m--;if(!m)return 0;
			cout<<b<<' '<<i<<endl;
			c[b][i]=c[i][b]=true;
			m--;if(!m)return 0;
		}
	foR(i,1,n+1)
		foR(j,i+1,n+1)
		if(i!=b&&j!=b&&!c[i][j]){
			cout<<i<<' '<<j<<endl;
			c[i][j]=c[j][i]=true;
			m--;if(!m)return 0;
		}

	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <limits>
#include <functional>
#include <numeric>

#define iter(c) __typeof((c).begin())
#define Tr(a,b) for(iter(b) a = (b).begin(); a != (b).end(); ++a)
#define Fr(a,b,c) for(int a = b; a < c; ++a)
#define Rp(a,c) Fr(a,0,c)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define oo 0x3F3F3F3F

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef unsigned long long rash;
typedef vector<int> vi;

#define DBG(x) cout << #x << " == " << x << endl
#define dbg if(0)

#define N 310
int n, m, k;
bool mark[N];
bool pattern_1() {
    if(n == k) return false;
    if(m <= 1) return false;
    if(m > (1 + ((n - 1) * (n - 2)) / 2)) return false;
    int other = -1;
    Fr(i,1,n + 1) if(!mark[i]) { other = i; break; }

    int a = 1;
    while(a == other) ++a;
    int b = a + 1;
    while(b == other) ++b;
    printf("%d %d\n", a, other);
    printf("%d %d\n", b, other);

    m -= 2;
    Fr(i,1,n + 1) Fr(j,i + 1,n + 1) if(m) {
        if(i == a || j == a) continue;
        if(i == other && j == b) continue;
        if(i == b && j == other) continue;

        printf("%d %d\n", i, j);
        --m;
    }

    return true;
}

bool pattern_2() {
    if(n == k) return false;
    if(m <= 1) return false;
    if(m > (n - k + ((n - 1) * (n - 2)) / 2)) return false;

    int marked = -1, other = -1;
    Fr(i,1,n + 1) {
        if(mark[i] && marked == -1) marked = i;
        if(!mark[i] && other == -1) other = i;
    }

    printf("%d %d\n", marked, other);
    m -= 2;
    Fr(i,1,n + 1) if(m && i != marked && i != other && !mark[i]) {
        printf("%d %d\n", marked, i);
        --m;
    }

    pii solution = MP(other, -1);
    Fr(i,marked + 1,n + 1) if(mark[i]) {
        solution.S = i;
        break;
    }

    printf("%d %d\n", solution.F, solution.S);
    Fr(i,1,n + 1) Fr(j,i + 1,n + 1) if(m) {
        if(i == marked || j == marked) continue;
        if(i == solution.F && j == solution.S) continue;
        if(i == solution.S && j == solution.F) continue;

        printf("%d %d\n", i, j);
        --m;
    }

    return true;
}

int main() {
    scanf("%d%d%d", &n, &m, &k);
    Rp(i,n + 2) mark[i] = false;
    Rp(i,k) {
        int a; scanf("%d", &a);
        mark[a] = true;
    }

    if(pattern_2());
    else puts("-1");

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <limits>
#include <functional>
#include <numeric>

#define iter(c) __typeof((c).begin())
#define Tr(a,b) for(iter(b) a = (b).begin(); a != (b).end(); ++a)
#define Fr(a,b,c) for(int a = b; a < c; ++a)
#define Rp(a,c) Fr(a,0,c)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define oo 0x3F3F3F3F

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef unsigned long long rash;
typedef vector<int> vi;

#define DBG(x) cout << #x << " == " << x << endl
#define dbg if(0)

#define N 310
int n, m, k;
bool mark[N];
bool pattern_1() {
    if(n == k) return false;
    if(m <= 1) return false;
    if(m > (1 + ((n - 1) * (n - 2)) / 2)) return false;
    int other = -1;
    Fr(i,1,n + 1) if(!mark[i]) { other = i; break; }

    int a = 1;
    while(a == other) ++a;
    int b = a + 1;
    while(b == other) ++b;
    printf("%d %d\n", a, other);
    printf("%d %d\n", b, other);

    m -= 2;
    Fr(i,1,n + 1) Fr(j,i + 1,n + 1) if(m) {
        if(i == a || j == a) continue;
        if(i == other && j == b) continue;
        if(i == b && j == other) continue;

        printf("%d %d\n", i, j);
        --m;
    }

    return true;
}

int main() {
    scanf("%d%d%d", &n, &m, &k);
    Rp(i,n + 2) mark[i] = false;
    Rp(i,k) {
        int a; scanf("%d", &a);
        mark[a] = true;
    }

    if(pattern_1());
    else puts("-1");

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <limits>
#include <functional>
#include <numeric>

#define iter(c) __typeof((c).begin())
#define Tr(a,b) for(iter(b) a = (b).begin(); a != (b).end(); ++a)
#define Fr(a,b,c) for(int a = b; a < c; ++a)
#define Rp(a,c) Fr(a,0,c)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define oo 0x3F3F3F3F

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef unsigned long long rash;
typedef vector<int> vi;

#define DBG(x) cout << #x << " == " << x << endl
#define dbg if(0)

#define N 310
int n, m, k;
bool mark[N];

bool pattern() {
    if(n == k) return false;
    if(m + 1 <= n) return false;
    if(m <= 1) return false;
    if(m > (n - k + ((n - 1) * (n - 2)) / 2)) return false;

    int marked = -1, other = -1;
    Fr(i,1,n + 1) {
        if(mark[i] && marked == -1) marked = i;
        if(!mark[i] && other == -1) other = i;
    }

    Fr(i,1,n + 1) if(i != other) {
        printf("%d %d\n", other, i);
        --m;
    }

    Fr(i,1,n + 1) Fr(j,i + 1,n + 1) if(m) {
        if(i == marked || j == marked) continue;
        if(i == other  || j == other ) continue;

        printf("%d %d\n", i, j);
        --m;
    }

    Fr(i,1,n + 1) if(m && i != marked && i != other && !mark[i]) {
        printf("%d %d\n", marked, i);
        --m;
    }

    return true;
}

int main() {
    scanf("%d%d%d", &n, &m, &k);
    Rp(i,n + 2) mark[i] = false;
    Rp(i,k) {
        int a; scanf("%d", &a);
        mark[a] = true;
    }

    if(pattern());
    else puts("-1");

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <limits>
#include <functional>
#include <numeric>

#define iter(c) __typeof((c).begin())
#define Tr(a,b) for(iter(b) a = (b).begin(); a != (b).end(); ++a)
#define Fr(a,b,c) for(int a = b; a < c; ++a)
#define Rp(a,c) Fr(a,0,c)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define oo 0x3F3F3F3F

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef unsigned long long rash;
typedef vector<int> vi;

#define DBG(x) cout << #x << " == " << x << endl
#define dbg if(0)

#define N 310
int n, m, k;
bool mark[N];
bool pattern_1() {
    if(n == k) return false;
    if(m <= 1) return false;
    if(m > (1 + ((n - 1) * (n - 2)) / 2)) return false;
    int other = -1;
    Fr(i,1,n + 1) if(!mark[i]) { other = i; break; }

    int a = 1;
    while(a == other) ++a;
    int b = a + 1;
    while(b == other) ++b;
    printf("%d %d\n", a, other);
    printf("%d %d\n", b, other);
    m -= 2;
    Fr(i,1,n + 1) Fr(j,i + 1,n + 1) if(m && i != a && j != a) {
        printf("%d %d\n", i, j);
        --m;
    }

    return true;
}

int main() {
    scanf("%d%d%d", &n, &m, &k);
    Rp(i,n + 2) mark[i] = false;
    Rp(i,k) {
        int a; scanf("%d", &a);
        mark[a] = true;
    }

    if(pattern_1());
    else puts("-1");

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <limits>
#include <functional>
#include <numeric>

#define iter(c) __typeof((c).begin())
#define Tr(a,b) for(iter(b) a = (b).begin(); a != (b).end(); ++a)
#define Fr(a,b,c) for(int a = b; a < c; ++a)
#define Rp(a,c) Fr(a,0,c)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define oo 0x3F3F3F3F

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef unsigned long long rash;
typedef vector<int> vi;

#define DBG(x) cout << #x << " == " << x << endl
#define dbg if(0)

#define N 310
int n, m, k;
bool mark[N];

bool pattern() {
    if(n == k) return false;
    if(m + 1 < n) return false;
    if(m <= 1) return false;
    if(m > (n - k + ((n - 1) * (n - 2)) / 2)) return false;

    int marked = -1, other = -1;
    Fr(i,1,n + 1) {
        if(mark[i] && marked == -1) marked = i;
        if(!mark[i] && other == -1) other = i;
    }

    Fr(i,1,n + 1) if(i != other) {
        printf("%d %d\n", other, i);
        --m;
    }

    Fr(i,1,n + 1) Fr(j,i + 1,n + 1) if(m) {
        if(i == marked || j == marked) continue;
        if(i == other  || j == other ) continue;

        printf("%d %d\n", i, j);
        --m;
    }

    Fr(i,1,n + 1) if(m && i != marked && i != other && !mark[i]) {
        printf("%d %d\n", marked, i);
        --m;
    }

    return true;
}

int main() {
    scanf("%d%d%d", &n, &m, &k);
    Rp(i,n + 2) mark[i] = false;
    Rp(i,k) {
        int a; scanf("%d", &a);
        mark[a] = true;
    }

    if(pattern());
    else puts("-1");

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <limits>
#include <functional>
#include <numeric>

#define iter(c) __typeof((c).begin())
#define Tr(a,b) for(iter(b) a = (b).begin(); a != (b).end(); ++a)
#define Fr(a,b,c) for(int a = b; a < c; ++a)
#define Rp(a,c) Fr(a,0,c)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define oo 0x3F3F3F3F

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef unsigned long long rash;
typedef vector<int> vi;

#define DBG(x) cout << #x << " == " << x << endl
#define dbg if(0)

#define N 310
int n, m, k;
bool mark[N];
bool pattern_1() {
    if(n == k) return false;
    if(m <= 1) return false;
    if(m > (1 + ((n - 1) * (n - 2)) / 2)) return false;
    int other = -1;
    Fr(i,1,n + 1) if(!mark[i]) { other = i; break; }

    int a = 1;
    while(a == other) ++a;
    int b = a + 1;
    while(b == other) ++b;
    printf("%d %d\n", a, other);
    printf("%d %d\n", b, other);

    m -= 2;
    Fr(i,1,n + 1) Fr(j,i + 1,n + 1) if(m) {
        if(i == a || j == a) continue;
        if(i == other && j == b) continue;
        if(i == b && j == other) continue;

        printf("%d %d\n", i, j);
        --m;
    }

    return true;
}

bool pattern_2() {
    if(n == k) return false;
    if(m <= 1) return false;
    if(m > (n - k + ((n - 1) * (n - 2)) / 2)) return false;

    int marked = -1, other = -1;
    Fr(i,1,n + 1) {
        if(mark[i] && marked == -1) marked = i;
        if(!mark[i] && other == -1) other = i;
    }

    printf("%d %d\n", marked, other);
    m -= 2;
    Fr(i,1,n + 1) if(m && i != marked && i != other && !mark[i]) {
        printf("%d %d\n", marked, i);
        --m;
    }

    pii solution = MP(other, -1);
    Fr(i,marked + 1,n + 1) if(mark[i]) {
        solution.S = i;
        break;
    }

    printf("%d %d\n", solution.F, solution.S);
    Fr(i,1,n + 1) Fr(j,i + 1,n + 1) if(m) {
        if(i == marked || j == marked) continue;
        if(i == solution.F && j == solution.S) continue;
        if(i == solution.S && j == solution.F) continue;

        printf("%d %d\n", i, j);
        --m;
    }

    return true;
}

int main() {
    scanf("%d%d%d", &n, &m, &k);
    Rp(i,n + 2) mark[i] = false;
    Rp(i,k) {
        int a; scanf("%d", &a);
        mark[a] = true;
    }

    if(pattern_1());
    else if(pattern_2());
    else puts("-1");

    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>

#define maxlongint 2147483647
#define LL long long
#define pb push_back
#define mp make_pair

using namespace std;

vector <int> v1;

int v[1000];
int n,m,k,xx;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    if(k==n)
    {
        printf("-1\n");
    }
    else
    {
        int x=n-3;
        int maxedge=2+x*(x+1)/2+(n-k-1)+(n-3);
        if(maxedge<m)
        {
            printf("-1\n");
        }
        else
        {
            for(int i=1;i<=k;i++)
            {
                scanf("%d",&xx);
                v[xx]=-1;
            }
            int node=0;
            for(int i=1;i<=n;i++)if(!v[i]){node=i;v[i]=-2;break;}
            int nodel=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){nodel=i;v[i]=-3;break;}
            int noder=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){noder=i;v[i]=-3;break;}
            for(int i=1;i<=n;i++)
                if(v[i]>-2)v1.pb(i);
            printf("%d %d\n",node,nodel);
            printf("%d %d\n",node,noder);
            for(int i=0;i<v1.size();i++)
                printf("%d %d\n",noder,v1[i]);
            m-=(n-1);
            for(int i=0;i<v1.size()-1;i++)
            {
                if(!m)break;
                for(int j=i+1;j<v1.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v1[i],v1[j]);
                }
            }
            for(int i=1;i<=n;i++)
            {
                if(!m)break;
                m--;
                if(!v[i])printf("%d %d\n",nodel,i);
            }
            for(int i=0;i<v1.size();i++)
            {
                if(!m)break;
                m--;
                printf("%d %d\n",node,v1[i]);
            }
        }
    }
//    system("pause");
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>

#define maxlongint 2147483647
#define LL long long
#define pb push_back
#define mp make_pair

using namespace std;

vector <int> v1;

int v[1000];
int n,m,k,xx;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    if(k==n)
    {
        printf("-1\n");
    }
    else
    {
        int x=n-3;
        int maxedge=2+x*(x+1)/2+(n-k-1)+(n-3);
        if(maxedge<m)
        {
            printf("-1\n");
        }
        else
        {
            for(int i=1;i<=k;i++)
            {
                scanf("%d",&xx);
                v[xx]=-1;
            }
            int node=0;
            for(int i=1;i<=n;i++)if(!v[i]){node=i;v[i]=-2;break;}
            int nodel=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){nodel=i;v[i]=-3;break;}
            int noder=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){noder=i;v[i]=-3;break;}
            for(int i=1;i<=n;i++)
                if(!v[i])v1.pb(i);
            printf("%d %d\n",node,nodel);
            printf("%d %d\n",node,noder);
            for(int i=0;i<v1.size();i++)
                printf("%d %d\n",noder,v1[i]);
            m-=(n-1);
            for(int i=0;i<v1.size()-1;i++)
            {
                if(!m)break;
                for(int j=i+1;j<v1.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v1[i],v1[j]);
                }
            }
            for(int i=1;i<=n;i++)
            {
                if(!m)break;
                if(!v[i])printf("%d %d\n",nodel,i);
            }
            for(int i=0;i<v1.size();i++)
            {
                if(!m)break;
                printf("%d %d\n",node,v1[i]);
            }
        }
    }
//    system("pause");
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>

#define maxlongint 2147483647
#define LL long long
#define pb push_back
#define mp make_pair

using namespace std;

vector <int> v1;

int v[1000];
int n,m,k,xx;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    if(k==n)
    {
        printf("-1\n");
    }
    else
    {
        int x=n-3;
        int maxedge=2+x*(x+1)/2+(n-k-1);
        if(maxedge<m)
        {
            printf("-1\n");
        }
        else
        {
            for(int i=1;i<=k;i++)
            {
                scanf("%d",&xx);
                v[xx]=-1;
            }
            int node=0;
            for(int i=1;i<=n;i++)if(!v[i]){node=i;v[i]=-2;break;}
            int nodel=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){nodel=i;v[i]=-3;break;}
            int noder=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){noder=i;v[i]=-3;break;}
            for(int i=1;i<=n;i++)
                if(!v[i])v1.pb(i);
            printf("%d %d\n",node,nodel);
            printf("%d %d\n",node,noder);
            for(int i=0;i<v1.size();i++)
                printf("%d %d\n",noder,v1[i]);
            m-=(n-1);
            for(int i=0;i<v1.size()-1;i++)
            {
                if(!m)break;
                for(int j=i+1;j<v1.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v1[i],v1[j]);
                }
            }
            for(int i=1;i<=n;i++)
            {
                if(!m)break;
                if(!v[i])printf("%d %d\n",nodel,i);
            }
        }
    }
//    system("pause");
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>

#define maxlongint 2147483647
#define LL long long
#define pb push_back
#define mp make_pair

using namespace std;

vector <int> v1;

int v[1000];
int n,m,k,xx;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    if(k==n)
    {
        printf("-1\n");
    }
    else
    {
        int x=n-3;
        int maxedge=2+x*(x+1)/2+(n-k-1)+(n-3);
        if(maxedge<m)
        {
            printf("-1\n");
        }
        else
        {
            for(int i=1;i<=k;i++)
            {
                scanf("%d",&xx);
                v[xx]=-1;
            }
            int node=0;
            for(int i=1;i<=n;i++)if(!v[i]){node=i;v[i]=-2;break;}
            int nodel=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){nodel=i;v[i]=-3;break;}
            int noder=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){noder=i;v[i]=-3;break;}
            for(int i=1;i<=n;i++)
                if(v[i]>-2)v1.pb(i);
            printf("%d %d\n",node,nodel);
            printf("%d %d\n",node,noder);
            for(int i=0;i<v1.size();i++)
                printf("%d %d\n",noder,v1[i]);
            m-=(n-1);
            for(int i=0;i<v1.size()-1;i++)
            {
                if(!m)break;
                for(int j=i+1;j<v1.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v1[i],v1[j]);
                }
            }
            for(int i=1;i<=n;i++)
            {
                if(!m)break;
                if(!v[i])printf("%d %d\n",nodel,i);
            }
            for(int i=0;i<v1.size();i++)
            {
                if(!m)break;
                printf("%d %d\n",node,v1[i]);
            }
        }
    }
//    system("pause");
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>

#define maxlongint 2147483647
#define LL long long
#define pb push_back
#define mp make_pair

using namespace std;

vector <int> v1,v2;

int v[1000];
int n,m,k,xx;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    if(k==n)
    {
        printf("-1\n");
    }
    else
    {
        int n0=n-3,x=n0/2,y=(n0+1)/2;
        int maxedge=2+x+y+x*(x-1)/2+y*(y-1)/2+x*y;
        if(maxedge<m)
        {
            printf("-1\n");
        }
        else
        {
            for(int i=1;i<=k;i++)
            {
                scanf("%d",&xx);
                v[xx]=-1;
            }
            int node=0;
            for(int i=1;i<=n;i++)if(!v[i]){node=i;v[i]=100;break;}
            int nodel=0;
            for(int i=1;i<=n;i++)if(v[i]!=100){nodel=i;v[i]=100;break;}
            int noder=0;
            for(int i=1;i<=n;i++)if(v[i]!=100){noder=i;v[i]=100;break;}
            for(int i=1;i<=n;i++)
                if(v[i]!=100)
                {
                    if(x)
                    {
                        v1.pb(i);
                        x--;
                    }
                    else
                    {
                        v2.pb(i);
                        y--;
                    }
                }
            printf("%d %d\n",node,nodel);
            printf("%d %d\n",node,noder);
            for(int i=0;i<v1.size();i++)
                printf("%d %d\n",nodel,v1[i]);
            for(int i=0;i<v2.size();i++)
                printf("%d %d\n",noder,v2[i]);
            m-=(n-1);
            for(int i=0;i<v1.size()-1;i++)
            {
                if(!m)break;
                for(int j=i+1;j<v1.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v1[i],v1[j]);
                }
            }
            for(int i=0;i<v2.size()-1;i++)
            {
                if(!m)break;
                for(int j=i+1;j<v2.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v2[i],v2[j]);
                }
            }
            for(int i=0;i<v1.size();i++)
            {
                if(!m)break;
                for(int j=0;j<v2.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v1[i],v2[j]);
                }
            }
        }
    }
//    system("pause");
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>

#define maxlongint 2147483647
#define LL long long
#define pb push_back
#define mp make_pair

using namespace std;

vector <int> v1;

int v[1000];
int n,m,k,xx;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    if(k==n)
    {
        printf("-1\n");
    }
    else
    {
        int x=n-3;
        int maxedge=2+x*(x+1)/2+(n-k-1)+(n-3);
        cout<<maxedge<<endl;
        if(maxedge<m)
        {
            printf("-1\n");
        }
        else
        {
            for(int i=1;i<=k;i++)
            {
                scanf("%d",&xx);
                v[xx]=-1;
            }
            int node=0;
            for(int i=1;i<=n;i++)if(!v[i]){node=i;v[i]=-2;break;}
            int nodel=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){nodel=i;v[i]=-3;break;}
            int noder=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){noder=i;v[i]=-3;break;}
            for(int i=1;i<=n;i++)
                if(!v[i])v1.pb(i);
            printf("%d %d\n",node,nodel);
            printf("%d %d\n",node,noder);
            for(int i=0;i<v1.size();i++)
                printf("%d %d\n",noder,v1[i]);
            m-=(n-1);
            for(int i=0;i<v1.size()-1;i++)
            {
                if(!m)break;
                for(int j=i+1;j<v1.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v1[i],v1[j]);
                }
            }
            for(int i=1;i<=n;i++)
            {
                if(!m)break;
                if(!v[i])printf("%d %d\n",nodel,i);
            }
            for(int i=0;i<v1.size();i++)
            {
                if(!m)break;
                printf("%d %d\n",node,v1[i]);
            }
        }
    }
//    system("pause");
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>

#define maxlongint 2147483647
#define LL long long
#define pb push_back
#define mp make_pair

using namespace std;

vector <int> v1,v2;

int v[1000];
int n,m,k;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    if(k==n)
    {
        printf("-1\n");
    }
    else
    {
        int n0=n-3,x=n0/2,y=(n0+1)/2;
        int maxedge=2+x+y+x*(x-1)/2+y*(y-1)/2+x*y;
        if(maxedge<m)
        {
            printf("-1\n");
        }
        else
        {
            for(int i=1;i<=k;i++)
            {
                scanf("%d",&x);
                v[x]=-1;
            }
            int node=0;
            for(int i=1;i<=n;i++)if(!v[i]){node=i;v[i]=100;break;}
            int nodel=0;
            for(int i=1;i<=n;i++)if(v[i]!=100){nodel=i;v[i]=100;break;}
            int noder=0;
            for(int i=1;i<=n;i++)if(v[i]!=100){noder=i;v[i]=100;break;}
            for(int i=1;i<=n;i++)
                if(v[i]!=100)
                {
                    if(x)
                    {
                        v1.pb(i);
                        x--;
                    }
                    else
                    {
                        v2.pb(i);
                        y--;
                    }
                }
            printf("%d %d\n",node,nodel);
            printf("%d %d\n",node,noder);
            for(int i=0;i<v1.size();i++)
                printf("%d %d\n",nodel,v1[i]);
            for(int i=0;i<v2.size();i++)
                printf("%d %d\n",noder,v2[i]);
            m-=(n-1);
            for(int i=0;i<v1.size()-1;i++)
            {
                if(!m)break;
                for(int j=i+1;j<v1.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v1[i],v1[j]);
                }
            }
            for(int i=0;i<v2.size()-1;i++)
            {
                if(!m)break;
                for(int j=i+1;j<v2.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v2[i],v2[j]);
                }
            }
            for(int i=0;i<v1.size();i++)
            {
                if(!m)break;
                for(int j=0;j<v2.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v1[i],v2[j]);
                }
            }
        }
    }
//    system("pause");
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>

#define maxlongint 2147483647
#define LL long long
#define pb push_back
#define mp make_pair

using namespace std;

vector <int> v1,v2;

int v[1000];
int n,m,k,xx;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    if(k==n)
    {
        printf("-1\n");
    }
    else
    {
        int n0=n-3,x=0,y=n0;
        int maxedge=2+x+y+x*(x-1)/2+y*(y-1)/2+x*y;
        if(maxedge<m)
        {
            printf("-1\n");
        }
        else
        {
            for(int i=1;i<=k;i++)
            {
                scanf("%d",&xx);
                v[xx]=-1;
            }
            int node=0;
            for(int i=1;i<=n;i++)if(!v[i]){node=i;v[i]=100;break;}
            int nodel=0;
            for(int i=1;i<=n;i++)if(v[i]!=100){nodel=i;v[i]=100;break;}
            int noder=0;
            for(int i=1;i<=n;i++)if(v[i]!=100){noder=i;v[i]=100;break;}
            for(int i=1;i<=n;i++)
                if(v[i]!=100)
                {
                    if(x)
                    {
                        v1.pb(i);
                        x--;
                    }
                    else
                    {
                        v2.pb(i);
                        y--;
                    }
                }
            printf("%d %d\n",node,nodel);
            printf("%d %d\n",node,noder);
            for(int i=0;i<v1.size();i++)
                printf("%d %d\n",nodel,v1[i]);
            for(int i=0;i<v2.size();i++)
                printf("%d %d\n",noder,v2[i]);
            m-=(n-1);
            for(int i=0;i<v2.size()-1;i++)
            {
                if(!m)break;
                for(int j=i+1;j<v2.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v2[i],v2[j]);
                }
            }
        }
   }
//    system("pause");
    return 0;
}


#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>

#define maxlongint 2147483647
#define LL long long
#define pb push_back
#define mp make_pair

using namespace std;

vector <int> v1;

int v[1000];
int n,m,k,xx;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    if(k==n)
    {
        printf("-1\n");
    }
    else
    {
        int x=n-3;
        int maxedge=2+x*(x+1)/2+(n-k-1)+(n-3);
        if(maxedge<m)
        {
            printf("-1\n");
        }
        else
        {
            for(int i=1;i<=k;i++)
            {
                scanf("%d",&xx);
                v[xx]=-1;
            }
            int node=0;
            for(int i=1;i<=n;i++)if(!v[i]){node=i;v[i]=-2;break;}
            int nodel=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){nodel=i;v[i]=-3;break;}
            int noder=0;
            for(int i=1;i<=n;i++)if(v[i]==-1){noder=i;v[i]=-3;break;}
            for(int i=1;i<=n;i++)
                if(v[i]>-2)v1.pb(i);
            printf("%d %d\n",node,nodel);
            printf("%d %d\n",node,noder);
            for(int i=0;i<v1.size();i++)
                printf("%d %d\n",noder,v1[i]);
            m-=(n-1);
            for(int i=0;i<v1.size()-1;i++)
            {
                if(!m)break;
                for(int j=i+1;j<v1.size();j++)
                {
                    if(!m)break;
                    m--;
                    printf("%d %d\n",v1[i],v1[j]);
                }
            }
            for(int i=1;i<=n;i++)
            {
                if(!m)break;
                if(!v[i])
                {
                    m--;
                    printf("%d %d\n",nodel,i);
                }
            }
            for(int i=0;i<v1.size();i++)
            {
                if(!m)break;
                m--;
                printf("%d %d\n",node,v1[i]);
            }
        }
    }
//    system("pause");
    return 0;
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fornd(i, n) for(int i = ((int)n) - 1; i >= 0; --i)
#define mins(x, y) x = min(x,y)
#define maxs(x, y) x = max(x,y)

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //ios_base::sync_with_stdio(false);
    int n,m,k;
    //cin >> n >> m >> k;
    scanf("%d %d %d", &n, &m, &k);
    vector<int> mask(n+1,0);
    forn(i,k)
    {
        int cur = 0;
        scanf("%d", &cur);
        ++mask[cur-1];
    }
    if ((k == n) || (m > n*(n-1)/2 - (k-1)))
    {
        //cout << -1 << endl;
        printf("-1\n");
        return 0;
    }
    int t = 0;
    forn(i,n)
        if (!mask[i])
        {
            t = i;
            break;
        }
    int s = 0;
    forn(i,n)
        if ((i != t) && (mask[i]))
        {
            s = i;
            break;
        }
    vector<vector<bool> > can(n+1, vector<bool> (n+1, true));
    forn(i,n)
        if (mask[i])
            can[s][i] = can[i][s] = false;
    vector<bool> y(n+1,false);
    int count = 2;
    y[s] = y[t] = true;
    can[s][t] = can[t][s] = false;
    printf("%d %d\n", s+1, t+1);
//  cout << s+1 << " " << t+1 << "\n";
    forn(i,n)
        if ((i != t)&&(i != s))
        {
            //cout << i+1 << " " << t+1  << "\n";
            printf("%d %d\n", i+1, t+1);
            can[i][t] = can[t][i] = false;
            y[i] = true;
            break;
        }

    while (count < n-1)
    {
        forn(i,n)
        {
            forn(j,n)
            {
                if ((y[i])&&(!y[j])&&can[i][j])
                {
                    //cout << i+1 << " " << j+1 << "\n";
                    printf("%d %d\n", i+1, j+1);
                    can[i][j] = can[j][i] = false;
                    ++count;
                    y[j] = true;
                }
                if (count == n-1)
                    break;
            }
            if (count == n-1)
                    break;
        }
    }

    forn(i,n)
    {
        forn(j,n)
        {
            if ((i != j)&&(can[i][j]))
            {
                printf("%d %d\n", i+1, j+1);
                can[i][j] = can[j][i] = false;
                ++count;
            }
            if (count == m)
                break;
        }
        if (count == m)
                break;
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fornd(i, n) for(int i = ((int)n) - 1; i >= 0; --i)
#define mins(x, y) x = min(x,y)
#define maxs(x, y) x = max(x,y)

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    int n,m,k;
    cin >> n >> m >> k;
    vector<int> mask(n+1,0);
    forn(i,k)
    {
        int cur = 0;
        cin >> cur;
        ++mask[cur];
    }
    if ((k == n) || (m > n*(n-1)/2 - (n-2)))
    {
        cout << -1 << endl;
        return 0;
    }
    vector<pair<int,int> > ans;
    int t = 0;
    for(int i = 1; i <= n; ++i)
        if (!mask[i])
        {
            t = i-1;
            break;
        }
    int start = (t+2)%n;
    int finish = (t+1)%n;

    for(int i = start; i != finish; i = (i+1)%n)
    {
        ans.push_back(make_pair(i, (i+1)%n));
    }
    int count = n-1;
    while (count < m)
    {
        for(int i = start; i != finish; i = (i+1)%n)
        {
            if ((i+1)%n != t)
            {
                for(int j = (i+2)%n; j != finish; j = (j+1)%n)
                {
                    ++count;
                    ans.push_back(make_pair(i,j));
                    if (count == m)
                        break;
                }
            }
            if (count == m)
                break;
        }
    }
    forn(i,ans.size())
        cout << ans[i].first+1 << " " << ans[i].second+1 << "\n";
    return 0;
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fornd(i, n) for(int i = ((int)n) - 1; i >= 0; --i)
#define mins(x, y) x = min(x,y)
#define maxs(x, y) x = max(x,y)

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //ios_base::sync_with_stdio(false);
    int n,m,k;
    //cin >> n >> m >> k;
    scanf("%d %d %d", &n, &m, &k);
    vector<int> mask(n+1,0);
    forn(i,k)
    {
        int cur = 0;
        scanf("%d", &cur);
        ++mask[cur-1];
    }
    if ((k == n) || (m > n*(n-1)/2 - (k-1)))
    {
        //cout << -1 << endl;
        printf("-1\n");
        return 0;
    }
    int t = 0;
    forn(i,n)
        if (!mask[i])
        {
            t = i;
            break;
        }
    int s = 0;
    forn(i,n)
        if (i != t)
        {
            s = i;
            break;
        }
    vector<vector<bool> > can(n+1, vector<bool> (n+1, true));
    forn(i,n)
        if (mask[i])
            can[s][i] = can[i][s] = false;
    vector<bool> y(n+1,false);
    int count = 2;
    y[s] = y[t] = true;
    can[s][t] = can[t][s] = false;
    printf("%d %d\n", s+1, t+1);
//  cout << s+1 << " " << t+1 << "\n";
    forn(i,n)
        if ((i != t)&&(i != s))
        {
            //cout << i+1 << " " << t+1  << "\n";
            printf("%d %d\n", i+1, t+1);
            can[i][t] = can[t][i] = false;
            y[i] = true;
            break;
        }

    while (count < n-1)
    {
        forn(i,n)
        {
            forn(j,n)
            {
                if ((y[i])&&(!y[j])&&can[i][j])
                {
                    //cout << i+1 << " " << j+1 << "\n";
                    printf("%d %d\n", i+1, j+1);
                    can[i][j] = can[j][i] = false;
                    ++count;
                    y[j] = true;
                }
                if (count == n-1)
                    break;
            }
            if (count == n-1)
                    break;
        }
    }

        forn(i,n)
        {
            forn(j,n)
            {
                if ((i != j)&&(can[i][j]))
                {
                    //cout << i+1 << " " << j+1 << "\n";
                    printf("%d %d\n", i+1, j+1);
                    can[i][j] = can[j][i] = false;
                    ++count;
                }
                if (count == m)
                    break;
            }
            if (count == m)
                    break;
        }

    return 0;
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fornd(i, n) for(int i = ((int)n) - 1; i >= 0; --i)
#define mins(x, y) x = min(x,y)
#define maxs(x, y) x = max(x,y)

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    int n,m,k;
    cin >> n >> m >> k;
    vector<int> mask(n+1,0);
    forn(i,k)
    {
        int cur = 0;
        cin >> cur;
        ++mask[cur];
    }
    if ((k == n) || (m > n*(n-1)/2 - (k - 1)))
    {
        cout << -1 << endl;
        return 0;
    }
    vector<pair<int,int> > ans;
    int t = 0;
    for(int i = 1; i <= n; ++i)
        if (!mask[i])
        {
            t = i-1;
            break;
        }
    int start = (t+2)%n;
    int finish = (t+1)%n;

    for(int i = start; i != finish; i = (i+1)%n)
    {
        ans.push_back(make_pair(i, (i+1)%n));
    }
    int count = n-1;
    while (count < m)
    {
        for(int i = start; i != finish; i = (i+1)%n)
        {
            if ((i+1)%n != t)
            {
                for(int j = (i+2)%n; j != finish; j = (j+1)%n)
                {
                    ++count;
                    ans.push_back(make_pair(i,j));
                    if (count == m)
                        break;
                }
            }
            else
            {
                for(int j = (i+2)%n; j != finish; j = (j+1)%n)
                {
                    if (mask[j] == 1)
                    {
                    ++count;
                    ans.push_back(make_pair(i,j));
                    if (count == m)
                        break;
                    }
                }
            }
            if (count == m)
                break;
        }
    }
    forn(i,ans.size())
        cout << ans[i].first+1 << " " << ans[i].second+1 << "\n";
    return 0;
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fornd(i, n) for(int i = ((int)n) - 1; i >= 0; --i)
#define mins(x, y) x = min(x,y)
#define maxs(x, y) x = max(x,y)

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    int n,m,k;
    cin >> n >> m >> k;
    vector<int> mask(n+1,0);
    forn(i,k)
    {
        int cur = 0;
        cin >> cur;
        ++mask[cur];
    }
    if ((k == n) || (m > n*(n-1)/2 - (n - k - 1)))
    {
        cout << -1 << endl;
        return 0;
    }
    vector<pair<int,int> > ans;
    int t = 0;
    for(int i = 1; i <= n; ++i)
        if (!mask[i])
        {
            t = i-1;
            break;
        }
    int start = (t+2)%n;
    int finish = (t+1)%n;

    for(int i = start; i != finish; i = (i+1)%n)
    {
        ans.push_back(make_pair(i, (i+1)%n));
    }
    int count = n-1;
    while (count < m)
    {
        for(int i = start; i != finish; i = (i+1)%n)
        {
            if ((i+1)%n != t)
            {
                for(int j = (i+2)%n; j != finish; j = (j+1)%n)
                {
                    ++count;
                    ans.push_back(make_pair(i,j));
                    if (count == m)
                        break;
                }
            }
            else
            {
                for(int j = (i+2)%n; j != finish; j = (j+1)%n)
                {
                    if (mask[j] == 1)
                    {
                    ++count;
                    ans.push_back(make_pair(i,j));
                    if (count == m)
                        break;
                    }
                }
            }
            if (count == m)
                break;
        }
    }
    forn(i,ans.size())
        cout << ans[i].first+1 << " " << ans[i].second+1 << "\n";
    return 0;
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fornd(i, n) for(int i = ((int)n) - 1; i >= 0; --i)
#define mins(x, y) x = min(x,y)
#define maxs(x, y) x = max(x,y)

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    int n,m,k;
    cin >> n >> m >> k;
    vector<int> mask(n+1,0);
    forn(i,k)
    {
        int cur = 0;
        cin >> cur;
        ++mask[cur];
    }
    if ((k == n) || (m > n*(n-1)/2 - (n-2)))
    {
        cout << -1 << endl;
        return 0;
    }
    vector<pair<int,int> > ans;
    int t = 0;
    for(int i = 1; i <= n; ++i)
        if (!mask[i])
        {
            t = i-1;
            break;
        }
    int start = 0;
    int finish = n-1;
    if (t == 0)
        start = 2, finish = 1;
    if (t == n-1)
        start = 1, finish = 0;

    for(int i = start; i != finish; i = (i+1)%n)
    {
        ans.push_back(make_pair(i, (i+1)%n));
    }
    int count = n-1;
    while (count < m)
    {
        for(int i = start; i != finish; i = (i+1)%n)
        {
            if ((i+1)%n != t)
            {
                for(int j = (i+1)%n; j != finish; j = (j+1)%n)
                {
                    if ((i+1)%n != j)
                    {
                        ++count;
                        ans.push_back(make_pair(i,j));
                    }
                    if (count == m)
                        break;
                }
            }
            if (count == m)
                break;
        }
    }
    forn(i,ans.size())
        cout << ans[i].first+1 << " " << ans[i].second+1 << "\n";
    return 0;
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fornd(i, n) for(int i = ((int)n) - 1; i >= 0; --i)
#define mins(x, y) x = min(x,y)
#define maxs(x, y) x = max(x,y)

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    int n,m,k;
    cin >> n >> m >> k;
    vector<int> mask(n+1,0);
    forn(i,k)
    {
        int cur = 0;
        cin >> cur;
        ++mask[cur-1];
    }
    if ((k == n) || (m > n*(n-1)/2 - (k-1)))
    {
        cout << -1 << endl;
        return 0;
    }
    int t = 0;
    forn(i,n)
        if (!mask[i])
        {
            t = i;
            break;
        }
    int s = 0;
    forn(i,n)
        if (i != t)
        {
            s = i;
            break;
        }
    vector<vector<bool> > can(n+1, vector<bool> (n+1, true));
    forn(i,n)
        if (mask[i])
            can[s][i] = can[i][s] = false;
    vector<bool> y(n+1,false);
    int count = 2;
    y[s] = y[t] = true;
    can[s][t] = can[t][s] = false;
    cout << s+1 << " " << t+1 << "\n";
    forn(i,n)
        if ((i != t)&&(i != s))
        {
            cout << i+1 <<" " << t+1  << "\n";
            can[i][t] = can[t][i] = false;
            y[i] = true;
            break;
        }

    while (count < n-1)
    {
        forn(i,n)
        {
            forn(j,n)
            {
                if ((y[i])&&(!y[j])&&can[i][j])
                {
                    cout << i+1 << " " << j+1 << "\n";
                    can[i][j] = can[j][i] = false;
                    ++count;
                    y[j] = true;
                }
                if (count == n-1)
                    break;
            }
            if (count == n-1)
                    break;
        }
    }

    while (count < m)
    {
        forn(i,n)
        {
            forn(j,n)
            {
                if ((i != j)&&(can[i][j]))
                {
                    cout << i+1 << " " << j+1 << "\n";
                    can[i][j] = can[j][i] = false;
                    ++count;
                }
                if (count == m)
                    break;
            }
            if (count == m)
                    break;
        }
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fornd(i, n) for(int i = ((int)n) - 1; i >= 0; --i)
#define mins(x, y) x = min(x,y)
#define maxs(x, y) x = max(x,y)

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    int n,m,k;
    cin >> n >> m >> k;
    vector<int> mask(n+1,0);
    forn(i,k)
    {
        int cur = 0;
        cin >> cur;
        ++mask[cur];
    }
    if ((k == n) || (m > n*(n-1)/2 - (k-1)))
    {
        cout << -1 << endl;
        return 0;
    }
    vector<pair<int,int> > ans;
    int t = 0;
    for(int i = 1; i <= n; ++i)
        if (!mask[i])
        {
            t = i-1;
            break;
        }
    int start = (t+2)%n;
    int finish = (t+1)%n;

    for(int i = start; i != finish; i = (i+1)%n)
    {
        ans.push_back(make_pair(i, (i+1)%n));
    }
    int count = n-1;
    while (count < m)
    {
        for(int i = start; i != finish; i = (i+1)%n)
        {
            if ((i+1)%n != t)
            {
                for(int j = (i+2)%n; j != finish; j = (j+1)%n)
                {
                    ++count;
                    ans.push_back(make_pair(i,j));
                    if (count == m)
                        break;
                }
            }
            if (count == m)
                break;
        }
    }
    forn(i,ans.size())
        cout << ans[i].first+1 << " " << ans[i].second+1 << "\n";
    return 0;
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fornd(i, n) for(int i = ((int)n) - 1; i >= 0; --i)
#define mins(x, y) x = min(x,y)
#define maxs(x, y) x = max(x,y)

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //ios_base::sync_with_stdio(false);
    int n,m,k;
    //cin >> n >> m >> k;
    scanf("%d %d %d", &n, &m, &k);
    vector<int> mask(n+1,0);
    forn(i,k)
    {
        int cur = 0;
        scanf("%d", &cur);
        ++mask[cur-1];
    }
    if ((k == n) || (m > n*(n-1)/2 - (k-1)))
    {
        //cout << -1 << endl;
        printf("-1\n");
        return 0;
    }
    int t = 0;
    forn(i,n)
        if (!mask[i])
        {
            t = i;
            break;
        }
    int s = 0;
    forn(i,n)
        if ((i != t)&&(!mask[i]))
        {
            s = i;
            break;
        }
    vector<vector<bool> > can(n+1, vector<bool> (n+1, true));
    forn(i,n)
        if (mask[i])
            can[s][i] = can[i][s] = false;
    vector<bool> y(n+1,false);
    int count = 2;
    y[s] = y[t] = true;
    can[s][t] = can[t][s] = false;
    printf("%d %d\n", s+1, t+1);
//  cout << s+1 << " " << t+1 << "\n";
    forn(i,n)
        if ((i != t)&&(i != s))
        {
            //cout << i+1 << " " << t+1  << "\n";
            printf("%d %d\n", i+1, t+1);
            can[i][t] = can[t][i] = false;
            y[i] = true;
            break;
        }

    while (count < n-1)
    {
        forn(i,n)
        {
            forn(j,n)
            {
                if ((y[i])&&(!y[j])&&can[i][j])
                {
                    //cout << i+1 << " " << j+1 << "\n";
                    printf("%d %d\n", i+1, j+1);
                    can[i][j] = can[j][i] = false;
                    ++count;
                    y[j] = true;
                }
                if (count == n-1)
                    break;
            }
            if (count == n-1)
                    break;
        }
    }

    forn(i,n)
    {
        forn(j,n)
        {
            if ((i != j)&&(can[i][j]))
            {
                printf("%d %d\n", i+1, j+1);
                can[i][j] = can[j][i] = false;
                ++count;
            }
            if (count == m)
                break;
        }
        if (count == m)
                break;
    }

    return 0;
}


#include <bits/stdc++.h>

#define eps 1e-9

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(_) ((_)*(_))

#define cb(_) ((_)*(_)*(_))

#define bit(x, y) (((x)>>(y))&1)

#define bctz(x) (__builtin_ctz(x))

#define bclz(x) (__builtin_clz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define bclzl(x) (__builtin_clzll(x))

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

#define x first

#define y second

#define out(x,y) (x<0||y<0||x>n||y>m)

using namespace std;

typedef double DO;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T> inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

template<class T1, class T2, class T3> inline void gn(T1 &x1, T2 &x2, T3 &x3) {gn(x1), gn(x2), gn(x3);}

template<class T1, class T2, class T3, class T4> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {gn(x1), gn(x2), gn(x3), gn(x4);}

template<class T> inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T> inline void printsp(T x) {print(x); putchar(' ');}

template<class T> inline void println(T x) {print(x); putchar('\n');}

template<class T1, class T2> inline void print(T1 x1, T2 x2){printsp(x1), println(x2);}

template<class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3){printsp(x1), printsp(x2), println(x3);}

template<class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4){printsp(x1), printsp(x2), printsp(x3), println(x4);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 111111

#define MM 8010

vector <int> ans,tmp;

bool flag[NN];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

    int n,m,k;

    gn(n,m,k);

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

	int s;

    for(int i=0;i<k;i++){

    	gn(s);

    	flag[s]=1;

	}

	int a=1; while(flag[a]==0) a++;

	int b=a+1; while(flag[b]==0) b++;

	for(int i=1;i<=n;i++) {

		if(!m) return 0;

		if(i!=a && i!=b) {printsp(a),println(i);m--;}

		if(flag[i]==0 && i!=b && i!=a) {printsp(b),println(i);m--;}

	}

	for(int i=1;i<=n;i++){

		if(i==a || i==b) continue;

		for(int j=i+1;j<=n;j++){

			if(j==a || j==b) continue;

			if(!m) break;

			printsp(j),println(i);m--;

		}

	}

	return 0;

}


#include <bits/stdc++.h>

#define eps 1e-9

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(_) ((_)*(_))

#define cb(_) ((_)*(_)*(_))

#define bit(x, y) (((x)>>(y))&1)

#define bctz(x) (__builtin_ctz(x))

#define bclz(x) (__builtin_clz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define bclzl(x) (__builtin_clzll(x))

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

#define x first

#define y second

#define out(x,y) (x<0||y<0||x>n||y>m)

using namespace std;

typedef double DO;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T> inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

template<class T1, class T2, class T3> inline void gn(T1 &x1, T2 &x2, T3 &x3) {gn(x1), gn(x2), gn(x3);}

template<class T1, class T2, class T3, class T4> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {gn(x1), gn(x2), gn(x3), gn(x4);}

template<class T> inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T> inline void printsp(T x) {print(x); putchar(' ');}

template<class T> inline void println(T x) {print(x); putchar('\n');}

template<class T1, class T2> inline void print(T1 x1, T2 x2){printsp(x1), println(x2);}

template<class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3){printsp(x1), printsp(x2), println(x3);}

template<class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4){printsp(x1), printsp(x2), printsp(x3), println(x4);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 111111

#define MM 8010

vector <int> ans,tmp;

bool flag[NN];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

    int n,m,k;

    gn(n,m,k);

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

	int s;

    for(int i=0;i<k;i++){

    	gn(s);

    	flag[s]=1;

	}

	int a=1; while(flag[a]==0) a++;

	int b=a+1; while(flag[b]==0) b++;

	for(int i=1;i<=n;i++) {

		if(!m) return 0;

		if(i!=a && i!=b) {printsp(a),println(i);m--;}

		if(!m) return 0;

		if(flag[i]==0 && i!=b && i!=a) {printsp(b),println(i);m--;}

	}

	for(int i=1;i<=n;i++){

		if(i==a || i==b) continue;

		for(int j=i+1;j<=n;j++){

			if(j==a || j==b) continue;

			if(!m) return 0;

			printsp(j),println(i);m--;

		}

	}

	return 0;

}


#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(x) ((x)*(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T>inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template<class T>inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T>inline void printsp(T x) {print(x); putchar(' ');}

template<class T>inline void println(T x) {print(x); putchar('\n');}

template<class T, class U>inline void print(T x, U y) {printsp(x); println(y);}

template<class T, class U, class V>inline void print(T x, U y, V z) {printsp(x); printsp(y); println(z);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

int a[1000],flag[1000];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n,m,k;cin>>n>>m>>k;

	for(int i=1; i<=k; i++) {

		scanf("%d",&a[i]);

		flag[a[i]]=1;

	}

	sort(a+1,a+k+1);

	int t=1;

	for(int i=k+1; i<=n; i++){

		while(flag[t]==1) t++;

		a[i]=t;

		flag[t]=1;

	}

	if (m>(n-1)*(n-2)/2+n-k) {

		puts("-1");

		return 0;

	}

	if(k==n||m<n-1){

		puts("-1");

		return 0;

	}

	int cnt=0;

	for(int i=3; i<=n; i++) {

		printf("%d %d\n",a[i],a[1]);

		cnt++;

	}

	for(int i=k+1; i<=n; i++){

		printf("%d %d\n",a[2],a[i]);

		cnt++;

		if(cnt==m) return 0;

	}

	for(int i=3; i<=k; i++) for(int j=k+1; j<=n; j++){

		printf("%d %d\n",a[i],a[j]);

		cnt++;

		if(cnt==m) return 0;

	}

	return 0;

}


#include <bits/stdc++.h>

#define NN 111000

using namespace std;

typedef long long INT;

typedef pair<int, int> pii;

int vst[NN], a[NN], flag[NN];

map<pii, int> pos;

pii ans[NN];

int main() {

	int n,i,j,m,k;

	cin>>n>>m>>k;

	for(i=0; i<k; i++) scanf("%d", a+i), vst[a[i]]=1;

	if(n==k) {puts("-1"); return 0;}

	int nn=0;

	for(i=1; i<=n; i++){

		for(j=i+1; j<=n; j++){

			pos[pii(i, j)]=nn;

			ans[nn++]=pii(i, j);

		}

	}

	for(i=0; i<k-1; i++){

		int x=a[i], y=a[k-1];

		if(x>y) swap(x, y);

		flag[pos[pii(x ,y)]]=1;

	}

	int cnt=n*(n-1)/2-k+1;

	if(m>=cnt) {puts("-1"); return 0;}

	int step=0;

	for(i=0; step<m; i++) {

		if(flag[i]) continue;

		step++;

		printf("%d %d\n", ans[i].first, ans[i].second);

	}

	return 0;

}


#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(x) ((x)*(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T>inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template<class T>inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T>inline void printsp(T x) {print(x); putchar(' ');}

template<class T>inline void println(T x) {print(x); putchar('\n');}

template<class T, class U>inline void print(T x, U y) {printsp(x); println(y);}

template<class T, class U, class V>inline void print(T x, U y, V z) {printsp(x); printsp(y); println(z);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

int a[1000],flag[1000];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n,m,k;cin>>n>>m>>k;

	for(int i=1; i<=k; i++) {

		scanf("%d",&a[i]);

		flag[a[i]]=1;

	}

	sort(a+1,a+k+1);

	int t=1;

	for(int i=k+1; i<=n; i++){

		while(flag[t]==1) t++;

		a[i]=t;

		flag[t]=1;

	}

	if (m>(n-1)*(n-2)/2+n-k) {

		puts("-1");

		return 0;

	}

	if(k==n||m<n-1){

		puts("-1");

		return 0;

	}

	int cnt=0;

	for(int i=3; i<=n; i++) {

		printf("%d %d\n",a[i],a[1]);

		cnt++;

	}

	for(int i=k+1; i<=n; i++){

		printf("%d %d\n",a[2],a[i]);

		cnt++;

		if(cnt==m) return 0;

	}

	for(int i=3; i<n; i++) for(int j=i+1; j<=n; j++){

		printf("%d %d\n",a[i],a[j]);

		cnt++;

		if(cnt==m) return 0;

	}

	return 0;

}


#include <bits/stdc++.h>

#define eps 1e-9

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(_) ((_)*(_))

#define cb(_) ((_)*(_)*(_))

#define bit(x, y) (((x)>>(y))&1)

#define bctz(x) (__builtin_ctz(x))

#define bclz(x) (__builtin_clz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define bclzl(x) (__builtin_clzll(x))

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

#define x first

#define y second

#define out(x,y) (x<0||y<0||x>n||y>m)

using namespace std;

typedef double DO;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T> inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

template<class T1, class T2, class T3> inline void gn(T1 &x1, T2 &x2, T3 &x3) {gn(x1), gn(x2), gn(x3);}

template<class T1, class T2, class T3, class T4> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {gn(x1), gn(x2), gn(x3), gn(x4);}

template<class T> inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T> inline void printsp(T x) {print(x); putchar(' ');}

template<class T> inline void println(T x) {print(x); putchar('\n');}

template<class T1, class T2> inline void print(T1 x1, T2 x2){printsp(x1), println(x2);}

template<class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3){printsp(x1), printsp(x2), println(x3);}

template<class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4){printsp(x1), printsp(x2), printsp(x3), println(x4);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 111111

#define MM 8010

vector <int> ans,tmp;

bool flag[NN];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

    int n,m,k;

    gn(n,m,k);

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

	int s;

    for(int i=0;i<k;i++){

    	gn(s);

    	flag[s]=1;

	}

	int a=1; while(flag[a]==0) a++;

	int b=a+1; while(flag[b]==0) b++;

	for(int i=1;i<=n;i++) {

		if(!m) return 0;

		if(i!=a && i!=b) {printsp(a),println(i);m--;}

	}

	for(int i=1;i<=n;i++) {

	if(!m) return 0;

		if(flag[i]==0) {printsp(b),println(i);m--;}

	}

	for(int i=1;i<=n;i++){

		if(i==a || i==b) continue;

		for(int j=i+1;j<=n;j++){

			if(j==a || j==b) continue;

			if(!m) return 0;

			printsp(j),println(i);m--;

		}

	}

	return 0;

}


#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(x) ((x)*(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T>inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template<class T>inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T>inline void printsp(T x) {print(x); putchar(' ');}

template<class T>inline void println(T x) {print(x); putchar('\n');}

template<class T, class U>inline void print(T x, U y) {printsp(x); println(y);}

template<class T, class U, class V>inline void print(T x, U y, V z) {printsp(x); printsp(y); println(z);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

int a[1000],flag[1000];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n,m,k;cin>>n>>m>>k;

	for(int i=1; i<=k; i++) {

		scanf("%d",&a[i]);

		flag[a[i]]=1;

	}

	sort(a+1,a+k+1);

	int t=1;

	for(int i=k+1; i<=n; i++){

		while(flag[t]==1) t++;

		a[i]=t;

		flag[t]=1;

	}

	if((k-2)*(n-k)+n-2+n-k<m){

		puts("-1");

		return 0;

	}

	int cnt=0;

	for(int i=3; i<=n; i++) {

		printf("%d %d\n",a[i],a[1]);

		cnt++;

	}

	for(int i=k+1; i<=n; i++){

		printf("%d %d\n",a[2],a[i]);

		cnt++;

		if(cnt==m) return 0;

	}

	for(int i=3; i<=k; i++) for(int j=k+1; j<=n; j++){

		printf("%d %d\n",a[i],a[j]);

		cnt++;

		if(cnt==m) return 0;

	}

	return 0;

}


#include <bits/stdc++.h>

#define eps 1e-9

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(_) ((_)*(_))

#define cb(_) ((_)*(_)*(_))

#define bit(x, y) (((x)>>(y))&1)

#define bctz(x) (__builtin_ctz(x))

#define bclz(x) (__builtin_clz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define bclzl(x) (__builtin_clzll(x))

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

#define x first

#define y second

#define out(x,y) (x<0||y<0||x>n||y>m)

using namespace std;

typedef double DO;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<class T> inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

template<class T1, class T2, class T3> inline void gn(T1 &x1, T2 &x2, T3 &x3) {gn(x1), gn(x2), gn(x3);}

template<class T1, class T2, class T3, class T4> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {gn(x1), gn(x2), gn(x3), gn(x4);}

template<class T> inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T> inline void printsp(T x) {print(x); putchar(' ');}

template<class T> inline void println(T x) {print(x); putchar('\n');}

template<class T1, class T2> inline void print(T1 x1, T2 x2){printsp(x1), println(x2);}

template<class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3){printsp(x1), printsp(x2), println(x3);}

template<class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4){printsp(x1), printsp(x2), printsp(x3), println(x4);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 111111

#define MM 8010

vector <int> ans,tmp;

bool flag[NN];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

    int n,m,k;

    gn(n,m,k);

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

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

	int s;

    for(int i=0;i<k;i++){

    	gn(s);

    	flag[s]=1;

	}

	int a=1; while(flag[a]==0) a++;

	int b=a+1; while(flag[b]==0) b++;

	for(int i=1;i<=n;i++) {

		if(!m) return 0;

		if(i!=a && i!=b) {printsp(a),println(i);m--;}

		if(!m) return 0;

		if(flag[i]==0 && i!=b && i!=a) {printsp(b),println(i);m--;}

	}

	for(int i=1;i<=n;i++){

		if(i==a || i==b) continue;

		for(int j=i+1;j<=n;j++){

			if(j==a || j==b) continue;

			if(!m) return 0;

			printsp(j),println(i);m--;

		}

	}

	return 0;

}