#include<stdio.h>
struct structure{
    int n1,n2;
    int arr[100][100];
};
int main(){
    struct structure s1;
    scanf("%d %d",&s1.n1,&s1.n2);
    if(s1.n1<0 || s1.n2<0){
        printf("Invalid input");
        return 0;
    }
    int c=0,k=0,row=0;
    for(int i=0;i<s1.n1;i++){
        for(int j=0;j<s1.n2;j++){
            scanf("%d",&s1.arr[i][j]);
            c+=s1.arr[i][j];
            if(j+1==s1.n2){
                if(k<c){
                    k=c;
                    row=i;
                    
                }
            }
        }
         printf("%d",row);
        return 0;
}