Function to check if there exists a path from the cell ( X , Y ) of the matrix to any boundary cell with sum of elements at most K or not
static boolean findPath ( int [ ] [ ] board , int X , int Y , int M , int N , int K ) {