#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = (a); i < (n); i++)
#define all(x) x.begin(), x.end()
#ifdef _DEBUG
#define disp(x) cout << #x << " : " << x << endl
#else
#define disp(x)
#endif
using namespace std;
using ll = int64_t;

ll mod_pow(ll x, ll n, const ll mod){
    ll ans = 1;
    while(n){
        if(n & 1) ans = ans*x%mod;
        x = x*x%mod;
        n >>= 1;
    }
    return ans;
}

int main(){
    ll n, m; cin >> n >> m;
    const ll mod = m*m;

    ll ans = mod_pow(10, n, mod);
    ans /= m;
    ans %= m;
    cout << ans << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)


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

  int n,m;
  cin >> n >> m;
  ll max = 1e8;
  if(n==1 && m==0){
    cout << 1 <<" " << 2 << endl;
  }
  else if(n==m || n-1==m || m<0){
    cout << -1 << endl;
  }
  else {
    int l = 2;
    int ok_cnt=2;
    rep(i,n-1){
      cout << l <<" " << l+1 << endl;
      if(n-m==ok_cnt){
        cout << l-1 << " " << max << endl;
      }
      else if(i==n-2 && n-m>ok_cnt){
        cout << max-10 <<" " << max << endl;
      }
      l+=3;
      ok_cnt++;

    }



  }
  return 0;
    

}
