#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;

struct Edge{int to,from,cost;};

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define mp make_pair
#define PUTLINE cout<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};

double g[110][110];
double dp[110][110];

int main() {
	int n,m;
	for(;;){
		cin>>n>>m;
		if(n==0&&m==0)break;
		rep(y,n)rep(x,n)cin>>g[y][x];
		rep(y,m)rep(x,n)dp[y][x]=0;
		rep(i,n)dp[0][i]=1;
		repn(i,1,m-1)rep(j,n)rep(k,n)chmax(dp[i][j],dp[i-1][k]*g[k][j]);
		double res=0;
		rep(i,n)chmax(res,dp[m-1][i]);
		Int r=(res+0.005)*100;
		printf("%lld.%02lld\n",r/100,r%100);
	}
	return 0;
}