#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;

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

void solve()
{
	prev = VD( n, 1.0 );
	next = VD( n );

	for ( int k = 1; k < m; k++ )
	{
		for ( int i = 0; i < n; i++ )
		{
			next[i] = -1.0;
			for ( int j = 0; j < n; j++ )
			{
				double tmp = prev[j] * C[j][i];
				next[i] = max( next[i], tmp );
			}
		}
		prev = next;
	}

	answer = -1.0;
	for ( int i = 0; i < n; i++ )
		answer = max( answer, prev[i] );
}

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;
}