#include<stdio.h>


int main(void){

    int flag=0,money,i,j,temp=0;

    //read
    int N, M, X;
    scanf("%d %d %d", &N,&M,&X);

    //read
    int A[N][M+1];
    for(i=0;i<N;i++){
        for(j=0;j<M+1;j++){
            scanf("%d", &A[i][j]);
        }
    }

    //can't a goal
    for(j=0;j<M;j++){
        for(i=0;i<N;i++){
            temp += A[i][j+1];
        }
        if(temp<X){
            flag = -1;
            printf("-1");
            return 0;
        }
        temp = 0;
    }

    //money
    


    return 0;
}