#include <stdio.h>
#include <stdlib.h>

int main()
{
    unsigned long long a,n;
    printf("Unesite ukupan broj poena na mecu: ");
    scanf("%llu",&n);
    printf("Unesite minimalan broj poena koji je potreban za neki set: ");
    scanf("%llu",&a);
    if(n<3*a)
        printf("-1");
    else
    {
        int k;
        if(n<=6*(a-1))
        {
            k=n-3*a;
            if(k<=(a-2))
            {
                printf("%llu   %d\n",a,k);
                printf("%llu   0\n",a);
                printf("%llu   0\n",a);
            }
            else
            {
                printf("%llu   %llu\n",a,a-2);
                k-=(a-2);
                if(k<=(a-2))
                {
                    printf("%llu   %d\n",a,k);
                    printf("%llu   0\n",a);
                }
                else
                {
                    printf("%llu   %llu\n",a,a-2);
                    k-=(a-2);
                    printf("%llu   %d\n",a,k);
                }
            }
        }
        else
        {
            if(n<=8*(a-1))
            {
                k=n-4*a-(a-2);
                printf("%llu   %llu\n",a-2,a);
                if(k<=(a-2))
            {
                printf("%llu   %d\n",a,k);
                printf("%llu   0\n",a);
                printf("%llu   0\n",a);
            }
            else
            {
                printf("%llu   %llu\n",a,a-2);
                k-=(a-2);
                if(k<=(a-2))
                {
                    printf("%llu   %d\n",a,k);
                    printf("%llu   0\n",a);
                }
                else
                {
                    printf("%llu   %llu\n",a,a-2);
                    k-=(a-2);
                    printf("%llu   %d\n",a,k);
                }
            }
            }
            else
        {
            if(n%2==0)
            {
                printf("0   %llu\n",a);
                printf("%llu   0\n",a);
                printf("%llu   0\n",a);
                k=n-3*a;
                printf("%d   %d",k/2+1,k/2-1);
            }
            else
            {
                printf("1   %llu\n",a);
                printf("%llu   0\n",a);
                printf("%llu   0\n",a);
                k=n-3*a-1;
                printf("%d   %d",k/2+1,k/2-1);
            }
        }
        }
    }
}