#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,c[55][55],m,u;
int f[55][550][55];
int main()
{
freopen("brike.in","r",stdin);
freopen("brike.out","w",stdout);
scanf("%d%d",&n,&m);
for(int y=1;y<=n;y++)
for(int i=y;i<=n;i++)
{
int h;
scanf("%d",&h);
c[i][y]=c[i][y-1]+h;
}
for(int i=1;i<=n;i++)// i is the line
for(int k=0;k<=i;k++)//in this line,k wood were killed
for(int j=0;j<=min(m,(1+i)*i/2);j++)// j is the number of the wood killed
if(k<=j)
for(int p=max(k-1,0);p<=i-1;p++)
if(j>=p+k)
if(f[i][j][k]<f[i-1][j-k][p]+c[i][k])
{
f[i][j][k]=f[i-1][j-k][p]+c[i][k];
/*if(f[i][j][k]==64)
printf("%d %d %d\n",i,j,k);*/
if(j==m&&f[i][j][k]>u)
u=f[i][j][k];
}
printf("%d",u);
}