Java/HRNpattern1.java
import java.util.Scanner;

public class HRNpattern1{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int c = sc.nextInt();
        for(int i = 1; i <= r; i++){
            for(int j=1; j <= c; j++){
                if(i==1 || j==1 || i==r || j==c){
                System.out.print(j);
            }
                else{
                    System.out.print(" ");

                }
            }
            System.out.println();
        }
        sc.close();

    }
}