import java.util.Scanner; class no21{ public static void main(String[] args) { Scanner stdIn=new Scanner(System.in); int n=stdIn.nextInt(),k=stdIn.nextInt(),a,i,min=1000,max=0; for(i=0;ia)min=a; if(a>max)max=a; } System.out.print(max-min); } }