#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimization("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
using namespace std;
long long INF = 1e9 + 7;
long long MOD = 998244353;
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n, k, siz, r;
  cin >> n >> k;
  long long dp[n + 1][k + 1];
  memset(dp, 0, sizeof dp);
  for (int i = 1; i < n + 1; i++) {
    cin >> siz;
    for (int j = 1; j < k + 1; j++) {
      dp[i][j] = dp[i - 1][j];
    }
    long long sum = 0;
    for (int u = 1; u < siz + 1; u++) {
      cin >> r;
      sum += r;
      for (int j = u; j < k + 1; j++) {
        dp[i][j] = max(dp[i][j], dp[i - 1][j - u] + sum);
      }
    }
  }
  cout << dp[n][k];
}
