#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <climits>
using namespace std;

typedef vector <double> VD;
typedef vector <VD> VVD;
typedef vector <int> VI;

class info
{
public:
	int		id;
	double	score;
};

VVD C;	// cost
vector <info> prev;
vector <info> next;
int n;	// ì¿ÌíÞ
int m;	// ì¿ð^¦éñ
double answer;

void solve()
{
	prev = vector <info>( n );
	next = vector <info>( n );

	for ( int i = 0; i < n; i++ )
	{
		prev[i].id = i;
		prev[i].score = 1.0;
	}

	for ( int k = 1; k < m; k++ )
	{
		for ( int i = 0; i < n; i++ )
		{
			next[i].score = INT_MIN;
			for ( int j = 0; j < n; j++ )
			{
				double tmp = prev[j].score * C[prev[j].id][i];
				if ( next[i].score < tmp )
				{
					next[i].score = tmp;
					next[i].id = j;
				}
			}
		}
		prev = next;
	}

	answer = prev[0].score;
	for ( int i = 1; i < n; i++ )
		answer = max( answer, prev[i].score );
}

int main( void )
{
	while ( cin >> n >> m && n > 0 && m > 0 )
	{
		C = VVD( n, VD( n ) );

		// üÍ
		for ( int i = 0; i < n; i++ )
		{
			for ( int j = 0; j < n; j++ )
			{
				cin >> C[i][j];
			}
		}

		solve();

		cout.setf( ios::fixed );
		cout.precision( 2 );
		cout << answer << endl;
	}

	return 0;
}