"Little Deepu and Array" challenge
Your major performance issue is almost certainly the way you perform your output. This is a common problem in how online judges evaluate performance.... they assume output time is part of the algorithmic solve-time.
Output
When programs output data to the console it is seldom a performance critical aspect of code. So, why should that code be lightning-fast when the console redraws are slow. In other words, Java's System.out.print* methods are not designed to be as fast as some other languages. Specifically, the print*() methods are synchronized so that only one thread can print at a time. They also incur a fair amount of overhead to own, manage, and release the system resources attached to the console. Each time you call print*(...) you repeat a lot of this work.
The bottom line is that you should call these methods just once.
    StringBuilder sb = new StringBuilder();
    for (m=0; m &lt; size; m++) { 
        if(m &gt; 0) {
            sb.append(&quot; &quot;);
        }
        sb.append(list.get(m));
    }
    System.out.println(sb);

Put all the data in to a StringBuilder, and then print it once.
Other things
In addition, you code would benefit from using a number of more convenient mechanisms.... like whitespace and braces.
Your code is suffocating, it has no breathing room. Consider:

    String[] numbers = line5.split(&quot; &quot;);
    for(int z=0;z&lt;N;z++) list.add(Long.parseLong(numbers[z]));
    String line2 = br.readLine();


which should be:
    String[] numbers = line5.split(&quot; &quot;);
    for(int z=0; z &lt; N; z++) {
        list.add(Long.parseLong(numbers[z]));
    }
    String line2 = br.readLine();

Similarly, in other places you have no whitespace or braces on conde blocks or around operators.
Additionally, your variable names are irritating, and inconvenient. You have two variables called &quot;m&quot;, both M and m.
Finally, if you put your code in to more methods, it will give the Java compiler a chance to optimize the code when it compiles it. Java's basic using of performance compilation is a &quot;method&quot;, since you only have one method, and since it is only called once (the main method), your logic is never compiled and optimized properly.