#include <fstream>
#include <algorithm>
#include <vector>

using namespace std;

ifstream input("Bai1_13.inp");
ofstream output("Bai1_13.out");

struct store
{
	int ts;
	int ms;
	float val;
	void init(int t1, int t2)
	{
		ts = t1;
		ms = t2;
	}
};

bool comp(store a, store b)
{
	if (a.val == b.val)
	{
		return a.ts < b.ts;
	}
	else
	{
		return a.val < b.val;
	}
}

vector <store> a;

int main()
{
	int n, k;
	input >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 0; j <= i; ++j)
		{
			a.push_back(store{ j, i, float(j) / i });
		}
	}
	stable_sort(a.begin(), a.end(), comp);
	for (int i = 1; i < a.size(); ++i)
	{
		if (a[i - 1].val == a[i].val)
		{
			a.erase(a.begin() + i);
			--i;
		}
	}
	output << a.size() << '\n' << a[k - 1].ts << ' ' << a[k - 1].ms;
	input.close();
	output.close();
	return 0;
}