Java 代码
import java.util.Scanner;
public class Main
{
public static void print (int[] nums, int size)
{
for (int i = 0; i < size; i ++)
System.out.print (nums[i] + " ");
}
public static void main (String[] args)
{
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
int size = cin.nextInt();
int[] nums = new int[n];
for (int i = 0; i < n; i ++)
{
nums [i] = cin.nextInt();
}
print (nums, size);
}
}