#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807ll
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005

void solve()
{
    ll n,m;
    cin>>n>>m;
    if(m==0)
    {
        rep(i,1,n+1)
        {
            cout<<2*i<<" "<<2*i+1<<endl;
        }
        return;
    }
    if(m<0||m>n-2)
    {
        cout<<-1<<endl;
    }
    else
    {
        ll rem=n-m-1;
        ll l=1,r=1e9;
        rep(i,0,rem)
        {
            cout<<l<<" "<<r<<endl;
            l++;
            r--;
        }
        ll pre=rem+1;
        rep(i,0,m+1)
        {
            cout<<pre<<" "<<pre+1<<endl;
            pre+=2;
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    time
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int INF = (1<<30)-1;
const int MOD = 1e9+7;
const ll LINF = (1ll<<62)-1;

#define REP(i,n) for(int i=0;i<(n);++i)
#define COUT(x) cout<<(x)<<"\n"
#define COUT16(x) cout << fixed << setprecision(16) << (x) << "\n";

int main(){
    //input
   cin.tie(nullptr);
   ll n,a;cin >> n;
   unordered_map<int,ll>mp;
   REP(i,n){
       cin >> a;
       mp[a]++;
   }
   //map
   ll ans = n*(n-1)/2;
   for(auto &p:mp){
       ans -= (p.second-1)*p.second/2;
   }
   //output
   COUT(ans);
}

