Matrix Search 2D Sorted array

My code shows me run time error except for the sample test case