#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	long long n;
	int a, s = 3, sum;
	cin >> n >> a;

	if(n < 3*a) cout << -1;
	long long r[10] = {a,0,a,0,a,0};
	sum = 3*a;
	for(int i = 0; i < 3; i++)
		if(n - sum > 7) r[i*2+1] = 7;
		else r[i*2+1] = n-sum;
	if((n-sum)%2 == 0){
		r[3]++;	
		sum++;
	}
	r[0] += (n-sum)/2;
	r[1] += (n-sum)/2 + 1;

	for(int i = 0; i < 3; i++)
		cout << r[i*2] << " " << r[i*2+1] << "\n";
	return 0;
}