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

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)

int main() {
  int N, M;
  while(cin >> N >> M && (N|M)) {
    double p[N][N]; rep(i, N) rep(j, N) cin >> p[i][j];
    vector<double> dp(N, 1.0), next(N);
    rep(m, M-1) {
      rep(i, N) {
	rep(j, N) {
	  next[j] = max(next[j], dp[i]*p[i][j]);
	}
      }
      dp = next;
    }
    printf("%.2f\n", *max_element(dp.begin(), dp.end()));
  }
  return 0;
}