int main(void)
{
  int n, m, x;
  scanf("%d %d %d", &n, &m, &x);
  int i, j;
  int c[n], a[n][m], rikai[m];
  for (j = 0; j < m; j++)
    rikai[j] = 0;
  for (i = 0; i < n; i++)
  {
    scanf("%d", &c[i]);
    for (j = 0; j < m; j++)
    {
      scanf("%d", &a[i][j]);
      rikai[j] += a[i][j];
    }
  }
  
  for (j = 0; j < m; j++)
  {
    if (rikai[j] < x)
    {
      printf("-1");
      return 0;
    }
  }
  
}