#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, s, n) for (ll i = s; i < (ll)(n); i++)

int main() {
  ll N, M;
  cin >> N >> M;
  vector<ll> A(M);
  rep(i, 0, M) { cin >> A[i]; }
  if (M == 0) {
    cout << 1 << endl;
    return 0;
  }
  sort(A.begin(), A.end());
  vector<ll> dif;
  ll prev = 0;
  rep(i, 0, M) {
    ll num = A[i] - prev - 1;
    if (num != 0) {
      dif.push_back(num);
    }
    prev = A[i];
  }
  ll la = N - A[M - 1];
  if (la != 0) {
    dif.push_back(la);
  }

  ll k = 1001001001;
  for (auto di : dif) {
    k = min(k, di);
  }
  ll ans = 0;
  for (auto di : dif) {
    if (di % k == 0) {
      ans += di / k;
    } else {
      ans += di / k + 1;
    }
  }
  cout << ans << endl;
}
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;
//using namespace atcoder;

void solve(){
	ll n,m;
	cin>>n>>m;
	if(m<0){
		cout<<-1;
		return;
	}
	if(m==0){
		ll x=1;
		rep(i,n){
			cout<<x<<" "<<x+1<<"\n";
			x+=2;
		}
		return;
	}
	if(m>=n-1){
		cout<<-1;
		return;
	}
	vector<pair<ll,ll>>ans;
	ll maxv=1000000000;
	ans.eb(1,maxv);
	rep(i,n-m-2){
		ans.eb(2+i,maxv-(i+1));
	}
	ll left=n-m-1;
	rep(i,m+1){
		ans.eb(left+1,left+2);
		left+=2;
	}
	for(auto x:ans){
		cout<<x.first<<" "<<x.second<<"\n";
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}
