#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)

double dt[102][102];
double dp[102][102];
int n;

double dfs(int d,int v){
	if(abs(dp[d][v]+1)>1e-6)return dp[d][v];
	if(d == 0) return 1.0;
	double r=-1;
	for(int i = 0 ; i < n ; i++){
		r = max(r,dfs(d-1,i) * dt[i][v]);
	}

	return dp[d][v] = r;
}

int main(void){
	int m;
	while(cin>>n>>m,n+m){

		rep(i,n)
			rep(j,n)cin>>dt[i][j];
		rep(i,102)rep(j,102)dp[i][j] = -1;
		
		//rep(i,n)rep(j,n)cout<<dt[i][j]<<(j==n-1?'\n':' ');


		double r = 0;
		rep(i,n){
			r = max(r,dfs(m-1,i));
		}
		printf("%.2f\n",r+1/2*(1/10)*2);
	}
}