#include <bits/stdc++.h>
using namespace std;
int a[105];
int lef[105];
int rig[105];
int maxs[105];
int dp[10005];
int main() {
  ios::sync_with_stdio(false);
  int row;
  int ti;
  int i;
  int j;
  int k;
  int n;
  memset(a, 0, sizeof(a));
  memset(dp, 0, sizeof(dp));
  cin >> row >> ti;
  for (i = 1; i <= row; i++) {
    cin >> n;
    for (j = 1; j <= n; j++) cin >> a[j];
    memset(lef, 0, sizeof(lef));
    memset(rig, 0, sizeof(rig));
    memset(maxs, 0, sizeof(maxs));
    for (j = 1; j <= n; j++) lef[j] = lef[j - 1] + a[j];
    for (j = n; j >= 1; j--) rig[n - j + 1] = rig[n - j] + a[j];
    for (j = 1; j <= n; j++) {
      for (k = 0; k <= j; k++) {
        maxs[j] = max(maxs[j], lef[k] + rig[j - k]);
      }
    }
    for (j = ti; j >= 1; j--) {
      for (k = 1; k <= min(j, n); k++) {
        dp[j] = max(dp[j], dp[j - k] + maxs[k]);
      }
    }
  }
  cout << dp[ti] << endl;
}
