#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
 
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define len(x) int((x).size())
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define randint(n) uniform_int_distribution<int>(1, (n))(rng)

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

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

	if(n==1&&m==0)
	{
		cout << "1 2\n";
		return 0;
	}

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

	int diff = m+1;
	cout << 1 << " " << diff*2 + 2 << endl;
	n--;

	int cur=2;

	while(diff--)
	{
		cout << cur << " " << cur+1 << "\n";
		cur+=2;
		n--;
	}

	cur++;

	while(n--)
	{
		cout << cur << " " << cur+1 << "\n";
		cur+=2;
	}
}
#include<bits/stdc++.h>
using namespace std;
namespace IO
{
	const int buffer_size=1e5+5;
	char buf[buffer_size],*S,*T;
	bool flag_EOF;
	inline char read_char()
	{
	    if(S==T)
			T=(S=buf)+fread(buf,1,buffer_size,stdin);
	    return S!=T?*(S++):EOF;
	}
	inline int read_int()
	{
	    int flag=1;
	    char c=read_char();
	    while(c<'0'||c>'9')
	    {
	        if(c==EOF)
	        {
	            flag_EOF=true;
	            return 0;
	        }
	        flag=(c=='-'?-1:1);
	        c=read_char();
	    }
	    int x=0;
	    while(c>='0'&&c<='9')
	    {
	        x=x*10+(c^48);
	        c=read_char();
	    }
	    return x*flag;
	}
	char st[13];
	int _top;
	inline void Write(int x)
	{
		if(!x)
		{
			putchar('0');
			return;
		}
		if(x<0)
		{
			putchar('-');
			x=-x;
		}
		while(x)
		{
			st[++_top]=x%10+'0';
			x/=10;
		}
		while(_top>0)
			putchar(st[_top--]);
	}
}
const int max_N=2e5+5;
int a[max_N],b[max_N],p[max_N],id[max_N],pos[max_N];
inline bool cmp(int x,int y)
{
	return b[x]>=b[y];
}
typedef pair<int,int> P;
vector<P> ans;
int main()
{
	int N;
	scanf("%d",&N);
	for(int i=1;i<=N;++i)
		scanf("%d",a+i);
	for(int i=1;i<=N;++i)
		scanf("%d",b+i);
	for(int i=1;i<=N;++i)
	{
		scanf("%d",p+i);
		if(a[i]<=b[p[i]]&&p[i]!=i)
		{
			puts("-1");
			return 0;
		}
		id[p[i]]=i;
		pos[i]=i;
	}
	sort(pos+1,pos+N+1,cmp);
	for(int t=1;t<=N;++t)
	{
		int i=pos[t];
		if(p[i]==i)
			continue;
		int x=id[i];
		ans.push_back(P(i,x));
		swap(id[p[i]],id[p[x]]);
		swap(p[i],p[x]);
	}
	printf("%d\n",int(ans.size()));
	for(int i=0;i<int(ans.size());++i)
		printf("%d %d\n",ans[i].first,ans[i].second);
	return 0;
}
