#include<iostream>
#include<cstdio>

const double EPS = 1e-10;
int n, m;
//memo[i][j]: 直前にjを入れてi回目のときの最大倍率
//a[i][j]: 直前i
double a[101][101], memo[101][101];

double rec(int i, int j){
	if(memo[i][j] > -EPS){
		return memo[i][j];
	}

	if(i == m){
		return 1;
	}

	double res = 0;
	for(int u=1;u<=n;u++){
		res = std::max(res, a[j][u] * rec(i+1, u));
	}

	return memo[i][j] = res;
}

int main(){
	while(std::cin >> n >> m, n){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				std::cin >> a[i][j];
			}
		}

		for(int i=1;i<101;i++){
			a[0][i] = 1;
		}

		for(int i=0;i<101;i++){
			for(int j=0;j<101;j++){
				memo[i][j] = -1;
			}
		}
		
		printf("%.2f\n", rec(0, 0));
	}
}