#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cassert>
#include<cmath>
#define EPS 1e-10
using namespace std;

int m,n;
double dp[110][110];
int Just;
//vector<double> matrix[110];
double matrix[110][110];
double rec(int next,int counter){
  if(dp[next][counter] != -10)return dp[next][counter];
  if(counter  == 0){
    return 1.0;
  }
  double HANMA = 0.0,test=0.0;
  
  
  for(int i=0;i<n;i++){  
     
    //HANMA = max(HANMA,rec(i,counter-1)*matrix[next][i]);
    test = rec(i,counter-1)*matrix[next][i];
    if(test > HANMA)HANMA = test;
  } 
  
  dp[next][counter] = HANMA;
  return HANMA;
}
 
 
int main(){
   
  double In;
  
  while(cin >> n >> m && n && m){
    //for(int i=0;i<=n;i++)matrix[i].clear();
     
    for(int i=m;i>=0;i--)for(int j=0;j<n;j++)dp[j][i] = -10;
    for(int i=0;i<n;i++)dp[i][0] = dp[i][1] = 1;
  
  
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
    //cin >> matrix[i][j];
    scanf("%lf",&matrix[i][j]);
    //matrix[i].push_back(In);
      }
    }
  
 
    double ans = -1;
  
   
      for(int I=0;I<n;I++){
    Just = I;
    double tes = rec(I,m);
    ans = max(ans,dp[Just][m]);
      }
     
 
      //for(int i=1;i<=m;i++)cout << dp[0][i] << " ";
      //cout << endl;
 
    printf("%.2f\n",ans);
 
  }
  return 0;
}