#include <bits/stdc++.h>

using namespace std;

bool five_sets(int n, int a)
{
    int team_a[5];
    int team_b[5];

    team_a[4] = a;
    team_b[4] = 0;

    team_a[3] = a;
    team_b[3] = 0;

    team_a[2] = a;
    team_b[2] = 0;

    int left_in_total = n - 3*a;

    int k = left_in_total / 2;
    int l = k;

    if (k+l != left_in_total)
    {
        ++l;
    }

    team_a[0] = k/2;
    team_b[0] = team_a[0];

    if(team_a[0] + team_b[0] != k)
    {
        team_b[0]++;
        team_a[0]--;
        team_b[4]++;
    }
    else
    {
        team_a[0]-=2;
        team_b[4]+=2;
    }

    team_a[1] = l/2;
    team_b[1] = team_a[1];

    if(team_a[1] + team_b[1] != l)
    {
        team_b[1]++;
        team_a[1]--;
        team_b[3]++;
    }
    else
    {
        team_a[1]-=2;
        team_b[3]+=2;
    }

    int sum = 0;
    for(int i = 0; i < 5; ++i)
    {
        sum += team_a[i] + team_b[i];
    }
    if(sum != n)
    {
        return false;
    }

    for(int i = 0; i < 5; ++i)
    {
        cout << team_a[i] << " " << team_b[i] << "\n";
    }

    return true;
}

bool four_sets(int n, int a)
{
    int team_a[4];
    int team_b[4];

    team_a[3] = a;
    team_b[3] = 0;

    team_a[2] = a;
    team_b[2] = 0;

    team_a[1] = a;
    team_b[1] = 0;

    int left_in_total = n - 3*a;

    team_a[0] = left_in_total/2;
    team_b[0] = team_a[0];

    if(team_a[0] + team_b[0] != left_in_total)
    {
        team_b[0]++;
        team_a[0]--;
        team_b[3]++;
    }
    else
    {
        team_a[0]-=2;
        team_b[3]+=2;
    }

    int sum = 0;
    for(int i = 0; i < 4; ++i)
    {
        sum += team_a[i] + team_b[i];
    }
    if(sum != n)
    {
        return false;
    }

    for(int i = 0; i < 4; ++i)
    {
        cout << team_a[i] << " " << team_b[i] << "\n";
    }
    return true;
}

bool three_sets(int n, int a)
{
    int team_a[3];
    int team_b[3];

    team_a[2] = a;
    team_b[2] = 0;

    team_a[1] = a;
    team_b[1] = 0;


    int left_in_total = n - 2*a;

    team_a[0] = left_in_total/2;
    team_b[0] = team_a[0];

    if(team_a[0] + team_b[0] != left_in_total)
    {
        team_a[0]++;
        team_b[0]--;
        team_b[2]++;
    }
    else
    {
        team_a[0]++;
        team_b[0]--;
    }

    int sum = 0;
    for(int i = 0; i < 3; ++i)
    {
        sum += team_a[i] + team_b[i];
    }
    if(sum != n)
    {
        return false;
    }

    for(int i = 0; i < 3; ++i)
    {
        cout << team_a[i] << " " << team_b[i] << "\n";
    }
    return true;
}

int main()
{
    ios_base::sync_with_stdio(false);
    int N, A;
    cin >> N >> A;

    int s = N/A;
    if(s < 3)
    {
        cout << -1;
    }
    else
    {
      if(!three_sets(N, A))
      {
        if(!four_sets(N, A))
        {
          if(!five_sets(N, A))
          {
            cout << -1;
          }
        }
      }
    }

    return 0;
}