Direction Array: reducing complexity
Thanks for sharing your code!
Naming
Finding good names is the hardest part in programming, so always take your time to think about the names of your identifiers.
avoid single character names
Since the number of characters is quite limited in most languages you will soon run out of names. This means that you either have to choose another character which is not so obviously connected to the purpose of the variable. And/or you have to &quot;reuse&quot; variable names in different contexts. Both makes your code hard to read and understand for other persons. (keep in mind that you are that other person yourself if you look at your code in a few month!)
On the other hand in Java the length of identifier names is virtually unlimited. There is no penalty in any way for long identifier names. So don't be stingy with letters when choosing names.
avoid abbreviations
In your code you use some abbreviations such as the variable ara. Although this abbreviation makes sense to you (now) anyone reading your code being not familiar with the problem (like me) has a hard time finding out what this means.
If you do this to save typing work: remember that you way more often read your code than actually typing something. Also for Java you have good IDE support with code completion so that you most likely type a long identifier only once and later on select it from the IDEs code completion proposals.
OOP
Your code is a procedural approach to the problem.
There is nothing wrong with procedural approaches in general, but Java is an object oriented (OO) programming language and if you want to become a good Java programmer then you should start solving problems in an OO way.
But OOP doesn't mean to &quot;split up&quot; code into random classes.
The ultimate goal of OOP is to reduce code duplication, improve readability and support reuse as well as extending the code.
Doing OOP means that you follow certain principles which are (among others):

information hiding / encapsulation
single responsibility / separation of concerns
same level of abstraction
KISS (Keep it simple (and) stupid.)
DRY (Don't repeat yourself.)
&quot;Tell! Don't ask.&quot;
Law of Demeter (&quot;Don't talk to strangers!&quot;)


Here is a OO-ish approach to the problem.
The idea is that a &quot;cell&quot; (a position in an the array) &quot;knows&quot; its neighbors. This the solution does not need to iterate over the whole array multiple times. My approach need to visit only 4 cells per iteration. This I have 90% less compares to do compared to your procedural approach. The ratio gets better the bigger the array gets...
I introduced two custom classes:

a Cell class that does the actual search logic recursively.
a StartPosition class as a Data Transfer Object (DTO) which is needed to enable a method to return both, x and y coordinate of the starting point.

I ignored your restriction to only use Scanner as the only allowed import because it is somewhat overstated.
import java.io.PrintStream; // implicit dependency from System.out.
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Scanner;

public class DirectionArray {
    class Cell {
        private final int value;
        private final TreeSet&lt;Cell&gt; neighborsSortedByValue = new TreeSet&lt;&gt;((c1, c2) -&gt; c1.value - c2.value);

        public Cell(int value) {
            this.value = value;
        }

        public void addNeighbor(Cell neighbor) {
            neighborsSortedByValue.add(neighbor);
        }

        public void findSink(Collection&lt;Cell&gt; pathToSink) {
            pathToSink.add(this);
            Cell minNeighbor = neighborsSortedByValue.first();
            if (minNeighbor.value &lt; this.value)
                // recursive call if lesser value neighbor exists
                minNeighbor.findSink(pathToSink);
        }

        @Override
        public String toString() {
            return value + &quot; &quot;;
        }

    }

    class StartPosition {
        private int x;
        private int y;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintStream out = System.out;
        new DirectionArray().runToSink(in, out);
    }

    void runToSink(Scanner in, PrintStream out) {
        Cell[][] cellArray = readArray(in);
        setNeighbors(cellArray);

        StartPosition startPosition = askForStartPosition(in, out);

        Collection&lt;Cell&gt; pathToSink = new ArrayList&lt;&gt;();
        cellArray[startPosition.x][startPosition.y].findSink(pathToSink);
        print(pathToSink, out);
    }

    private Cell[][] readArray(Scanner in) {
        int row = in.nextInt();
        int col = in.nextInt();
        Cell[][] cellArray = new Cell[row][col];
        for (int i = 0; i &lt; row; i++) {
            for (int j = 0; j &lt; col; j++) {
                cellArray[i][j] = new Cell(in.nextInt());
            }
        }
        return cellArray;
    }

    private void setNeighbors(Cell[][] cellArray) {
        for (int i = 0; i &lt; cellArray.length; i++) {
            for (int j = 0; j &lt; cellArray[i].length; j++) {
                setNeighborsToCell(i, j, cellArray);
            }
        }
    }

    private void setNeighborsToCell(int i, int j, Cell[][] cellArray) {
        for (int x : new int[] { -1, 1 }) { // one force, one back
            // neighbors in column
            cellArray[i][j].addNeighbor(cellArray[calculateNeighborIndex(i, x, cellArray.length)][j]);
            // neighbors in row
            cellArray[i][j].addNeighbor(cellArray[i][calculateNeighborIndex(j, cellArray[i].length, x)]);
        }
    }

    private int calculateNeighborIndex(int i, int x, int length) {
        return (length + i + x) % length;
    }

    private StartPosition askForStartPosition(Scanner in, PrintStream out) {
        StartPosition startPosition = new StartPosition();
        out.println(&quot;Give starting point(x) &quot;);
        startPosition.x = in.nextInt();
        out.println(&quot;Give starting point(y) &quot;);
        startPosition.y = in.nextInt();
        return startPosition;
    }

    private void print(Collection&lt;Cell&gt; pathToSink, PrintStream out) {
        for (Cell pathStep : pathToSink) {
            out.print(pathStep);
        }
    }
}

Finally I created a test driver a class that runs the solution with your test data. This test class is run by the JUnit framework:
import static org.hamcrest.CoreMatchers.endsWith;
import static org.junit.Assert.*;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.Scanner;

import org.junit.Test;

public class DirectionArrayTest {

    @Test
    public void test() {
        Scanner scanner = new Scanner(new ByteArrayInputStream(
                (&quot;5 5\n&quot; + // array dimensions
                 &quot;1  2  3  4  5\n&quot; + 
                 &quot;6  7  8  9  10\n&quot; + 
                 &quot;11 12 13 14 15\n&quot; + 
                 &quot;16 17 18 19 20\n&quot; + 
                 &quot;21 22 23 24 25\n&quot; +
                 &quot;2 2\n&quot; // start position index
                 ).getBytes()));
    
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        PrintStream out = new PrintStream(byteArrayOutputStream);
        
        new DirectionArray().runToSink(scanner, out);

        System.out.println(byteArrayOutputStream.toString());
        assertThat(byteArrayOutputStream.toString(), endsWith(&quot;13 8 3 1 &quot;));
    }

}