#include <bits/stdc++.h>

using namespace std;

int main(int argc, char** argv)
{
	
	long long int ukupan;
	long long int set;
	
	cin >> ukupan;
	cin >> set;
	
	if(ukupan < 3*set)
	{
		cout << "-1";
		return 0;
	}
	
	long long int set1[] = {set,set-2};
	long long int set2[] = {set,set-2};
	long long int set3[] = {set,set-2};
	
	int suma = 6 * (set - 1);
	
	if((ukupan-set2[0]-set2[1]-set3[0]-set3[1])%2==1)
	{
		set2[1]--;
	}

	while(suma!=ukupan)
	{
		if(suma<ukupan)
		{
			set1[0]++;
			set1[1]++;
			suma=set1[0]+set1[1]+set2[0]+set2[1]+set3[0]+set3[1];
		}
		else
		{
			if(suma-ukupan==2)
			{
				set2[1]--;
				set3[1]--;
				break;
			}
			if(suma-ukupan==1)
			{
				set3[1]--;
				break;
			}
			set2[1]--;
			set2[1]--;
			set3[1]--;
			while(set2[1]<0)
			{
				set2[1]++;
				set1[1]--;
			}
			suma=set1[0]+set1[1]+set2[0]+set2[1]+set3[0]+set3[1];
		}
	}
		while(set2[1]<0)
			{
				set2[1]++;
				set1[1]--;
			}
	
	if(set1[0]-set1[1]>2 && set1[0]>set)
	{
		cout << "-1";
		return 0;
	}
	printf("%d %d\n%d %d\n%d %d\n",set1[0],set1[1],set2[0],set2[1],set3[0],set3[1]);
		
	return 0;
}