#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	cout << fixed << setprecision(2);
	while (1) {
		int N, M; cin >> N >> M;
		if (!N)break;
		vector<vector<ld>>field(N+1, vector<ld>(N));
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				cin >> field[i][j];
			}
			
		}
		for (int j = 0; j < N; ++j) {
			field[N][j] = 1;
		}
		vector<vector<ld>>dp(M + 1, vector<ld>(N+1));
		dp[0][N] = 1;
		for (int t = 0; t < M; ++t) {
			for (int pre = 0; pre <= N; ++pre) {
				for (int next = 0; next < N; ++next) {
					dp[t + 1][next] = max(dp[t + 1][next], dp[t][pre] * field[pre][next]);
				}
			}
		}
		ld ans = 0;
		for (int i = 0; i < N; ++i) {
			ans = max(ans, dp[M][i]);
		}
		cout << ans << endl;
	}
	return 0;
}