#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;
double key[100][100];
double table[100][100][100];

void Init(int n, int m){
	for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) for(int k = 0; k < m+1; k++)table[i][j][k] = 0;
}

double memo(int prev, int cur, int count, int limit, int kind){
	if(table[prev][cur][count]) return table[prev][cur][count];
	if(count==limit) return 1.0;
	double Max = 0;
	for(int i = 0; i < kind; i++){
		Max = max(Max, memo(i, prev, count+1, limit, kind));
	}
	table[prev][cur][count] = Max*key[prev][cur];
	return table[prev][cur][count];
}

int main(){
	int n, m;
	while(cin >> n >> m && ((n!=0)||(m!=0))){
		Init(n, m);
		for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) cin >> key[i][j];
		for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) table[i][j][0] = memo(i, j, 1, m, n);
		double max = 0;
		for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(max < table[i][j][0]) max = table[i][j][0];
		printf("%0.2f\n", max);
	}

	return 0;
}