#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int m,n;
double a[100][100],b[100][100];
double f(int p,int q,double r){
  int i;
  double mx=0;
  if(p==m){
    mx=r;
  }else if(b[p][q]<r){
    b[p][q]=r;
    for(i=0;i<n;i++)
      mx=max(mx,f(p+1,i,r*a[q][i]));
  }
  return mx;
}
int main(){
  int i,j;
  double mx;
  while(cin>>n>>m&&n+m){
    for(i=0;i<n;i++)
      for(j=0;j<n;j++)
	cin>>a[i][j];
    memset(b,0,sizeof(b));
    mx=0;
    for(i=0;i<n;i++)
      mx=max(mx,f(1,i,1));
    printf("%.2lf\n",mx);
  }
  return 0;
}