#include <cstdio>
#include <algorithm>
using namespace std;

double growth[200][200];
double dp[200][200];

int main()
{
	int n, m;
	
	while (scanf("%d %d", &n, &m), n + m){
		for (int i = 0; i < 200; i++){
			dp[0][i] = 1.0;
			for (int j = 1; j < 200; j++){
				dp[j][i] = 0.0;
			}	
		}
		
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				scanf("%lf", &growth[i][j]);
			}
		}
		
		for (int i = 0; i < m - 1; i++){
//			printf("%d\n", i);
			for (int j = 0; j < n; j++){
				for (int k = 0; k < n; k++){
//					printf("%lf\n", dp[i][j] * growth[k][j]);
					dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] * growth[k][j]);
				}
//				printf("%d %lf\n", j, dp[i + 1][j]);
			}
		}
		
		double maxi = 0.0;
		for (int i = 0; i < n; i++){
			maxi = max(maxi, dp[m - 1][i]);
		}
		
		printf("%lf\n", maxi);
	}
	
	return 0;
}