The end of the school year is near and Ms. Manana, the teacher, will soon have to say goodbye to a yet another class. She decided to prepare a goodbye present for her n students and give each of them a jigsaw puzzle (which, as wikipedia states, is a tiling puzzle that requires the assembly of numerous small, often oddly shaped, interlocking and tessellating pieces).

The shop assistant told the teacher that there are m puzzles in the shop, but they might differ in difficulty and size. Specifically, the first jigsaw puzzle consists of f_1 pieces, the second one consists of f_2 pieces and so on.

Ms. Manana doesn't want to upset the children, so she decided that the difference between the numbers of pieces in her presents must be as small as possible. Let A be the number of pieces in the largest puzzle that the teacher buys and B be the number of pieces in the smallest such puzzle. She wants to choose such n puzzles that A - B is minimum possible. Help the teacher and find the least possible value of A - B.


-----Input-----

The first line contains space-separated integers n and m (2 ≤ n ≤ m ≤ 50). The second line contains m space-separated integers f_1, f_2, ..., f_{m} (4 ≤ f_{i} ≤ 1000) — the quantities of pieces in the puzzles sold in the shop.


-----Output-----

Print a single integer — the least possible difference the teacher can obtain.


-----Examples-----
Input
4 6
10 12 10 7 5 22

Output
5



-----Note-----

Sample 1. The class has 4 students. The shop sells 6 puzzles. If Ms. Manana buys the first four puzzles consisting of 10, 12, 10 and 7 pieces correspondingly, then the difference between the sizes of the largest and the smallest puzzle will be equal to 5. It is impossible to obtain a smaller difference. Note that the teacher can also buy puzzles 1, 3, 4 and 5 to obtain the difference 5.

Difficulty: interview

Starter code:

Solutions:
n, m = list(map(int, input().split()))
v = list(map(int, input().split()))
v = sorted(v)

diff = 10**10
for i in range(0, len(v)):
    if i+n-1 < len(v): diff = min(diff, v[i+n-1] - v[i])

print(diff)


n,m = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
l.sort()
best = l[-1]-l[0]
#print(best)
for i in range(len(l)-n+1):
    cur = l[i+n-1]-l[i]
    #print(i,l[i+n-1],l[i],cur,cur<best)
    if cur < best:
        best = cur
print(best)


def __starting_point():
    inp = input()
    arr = inp.split(" ")
    n = int(arr[0])
    m = int(arr[1])
    inp = input()
    arr = inp.split(" ")
    L = []
    for s in arr:
        L.append(int(s))
    L.sort()
    diff = L[n-1]-L[0]
    for i in range(m-n+1):
        diff = min(diff,L[i+n-1]-L[i])
    print(diff)

__starting_point()

n, m = list(map(int, input().split()))
puzzles = list(map(int, input().split()))

puzzles = sorted(puzzles)
diffs = []
for i in range(len(puzzles) - n + 1):
    diffs.append(puzzles[i+n-1] - puzzles[i])

print(min(diffs))


n, m = map(int, input().split())
arr = list(sorted(map(int, input().split())))
ans = arr[n - 1] - arr[0]
for i in range(1, m - n + 1):
    ans = min(ans, arr[i + n - 1] - arr[i])
print(ans)

from sys import stdin

(n, m) = list(map(int, input().split()));
nb = list(map(int, input().split()))

nb.sort();

minDiff = nb[m-1]
for i in range(n-1, m):
    minDiff = min(minDiff, nb[i] - nb[i-n+1])

print(minDiff)


n,m=list(map(int,input().split()))

A=list(map(int,input().split()))

A.sort()
minn=10000000

for i in range(0,m-n+1):
    if(abs(A[n+i-1]-A[i])<minn):
        minn=A[n+i-1]-A[i]
print(minn)


n, m = map(int, input().split())
f = sorted(map(int, input().split()))
res = max(f) - min(f)
for i in range(m - n + 1):
  res = min(res, f[i + n - 1] - f[i])
print(res)

import sys
my_file = sys.stdin
#my_file = open("input.txt", "r")
line = [int(i) for i in my_file.readline().strip('\n').split()]
n, m = line[0], line[1]
f = [int(i) for i in my_file.readline().split()]
f.sort()
min = f[n-1] - f[0]
for i in range(m):
    try:
        if f[n-1+i] - f[i] < min:
            min = f[n-1+i] - f[i]
    except:
        pass
print(min)

n, m = list(map(int, input().split()))
ar = list(map(int, input().split()))
ar.sort()
ans = ar[n - 1] - ar[0]
for i in range(1, m - n + 1):
    ans = min(ans, ar[i + n - 1] - ar[i])
print(ans)
#print(ar)


n, m = list(map(int, input().split()))
puzzle = list(sorted(list(map(int, input().split()))))
res = 1e6
for i in range(m - n + 1):
    res = min(res, puzzle[i + n - 1] - puzzle[i])
if res == 1e6:
    print(0)
else:
    print(res)

n, m = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
MIN = 1000000000
for i in range(m - n + 1):
    MIN = min(A[i + n - 1] - A[i], MIN)
print(MIN)


n,m=list(map(int,input().split()))
A=[]
A = list(map(int, input().split()))
A.sort()
B=[]
for i in range(m-n+1):
    B.append(A[n-1+i]-A[i])
B.sort()
print(B[0])
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             


3

import sys

n, m = list(map(int, sys.stdin.readline().strip().split()))
pieces = list(map(int, sys.stdin.readline().strip().split()))
pieces.sort()

diff = []

for i in range(0, m - n + 1):
    diff.append(pieces[i + n - 1] - pieces[i])

# print(diff)
print(min(diff))


n, m = [int(x) for x in input().split()]
a = sorted([int(x) for x in input().split()])
#print(a)
Min = a[n-1] - a[0]
#print(Min)
for i in range(m-n+1):
	x = a[i+n-1] - a[i]
#	print('x=',x)
#	print(i,i+n-1)
	if x < Min:
		Min = x
print(Min)


n,m=map(int,input().split())
A=sorted(list(map(int,input().split())))
count=100000000000
for i in range(m-1, -1, -1):
    if (i-n+1)<0:
        break
    else:
        count=min(count, A[i]-A[i-n+1])
print(count)

n, m = list(map(int, input().split()))
v = sorted(list(map(int, input().split())))
print(min(v[i+n-1]-v[i] for i in range(0, len(v)-n+1)))


n, m = list(map(int, input().split()))

f = list(map(int, input().split()))
f.sort()

lpd = f[n - 1] - f[0]

for i in range(1, m - n + 1, 1):
    if f[i + n - 1] - f[i] < lpd:
        lpd = f[i + n - 1] - f[i]

print(lpd)


n, m = map(int, input().split())
f = list(map(int, input().split()))
f.sort()
ans = f[m - 1] - f[0]
for i in range(m - n + 1):
    if ans > f[i + n - 1] - f[i]: 
        ans = f[i + n - 1] - f[i]
print(ans)

def solve(l, n, m):
    sl = sorted(l)
    #print(sl)
    return min([sl[i + n - 1] - sl[i] for i in range(m - n + 1)])

import random

def test():
    assert solve([9, 2], 2, 2) == 7
    assert solve([4, 4], 2, 2) == 0
    assert solve([9, 2, 4, 4], 2, 4) == 0
    assert solve([10, 12, 10, 7, 5, 22], 4, 6) == 5
    assert solve([1, 5, 2, 19], 2, 4) == 1
    print("test passes")

n, m = list(map(int, input().split()))
l = list(map(int, input().split()))
print(solve(l, n, m))
##test()



n,m = map(int,input().split())
a = list(sorted(map(int, input().split())))
ans  = 100500
for i in range(m-n+1):
    ans = min(ans, a[i+n-1]-a[i])
print(ans)

n,m = map(int,input().split())
a = list(sorted(map(int, input().split())))
ans  = 100500
for i in range(m-n+1):
    ans = min(ans, a[i+n-1]-a[i])
print(ans)

n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
res = 10 ** 100

for i in range(m - n + 1):
    res = min(res, A[n + i - 1] - A[i])
print(res)


import sys

tmp = list(map(int, sys.stdin.readline().split()))
n = tmp[1]
k = tmp[0]

a = list(map(int, sys.stdin.readline().split()))

a.sort()

res = 1000111000
for i in range(0,n-k+1):
    res = min(res, a[i+k-1] - a[i])

print(res)


N, M = list(map(int, input().split(' ')))

puzzles = list(map(int, input().split(' ')))

puzzles.sort()

ans = 100000000000

for i in range(N - 1, M):
    ans = min(ans, puzzles[i] - puzzles[i - N + 1])

print(ans)