Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M=map(int,input().split(" "))
if M>N:
    A=list(sorted(map(int,input().split(" "))))
    L=np.array([A[s]-A[s+1] for s in range(M-1)])
    for s in range(N-1):
        L[np.argmin(L)]=0
    print(abs(sum(L)))
else:
    print(0)

Fixed submission:
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]
if M>N:
    print(abs(sum(sorted(L)[N-1:])))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=np.array([A[s]-A[s+1] for s in range(M-1)])

if M>N:
    for s in range(N-1):
        L[np.argmin(L)]=0
    print(abs(sum(L)))
else:
    print(0)

Fixed submission:
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]
if M>N:
    print(abs(sum(sorted(L)[N-1:])))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=np.array([A[s]-A[s+1] for s in range(M-1)])

if M<=N:
    print(0)
else:
    for s in range(N-1):
        L[np.argmin(L)]=0
    print(abs(sum(L)))

Fixed submission:
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]
if M>N:
    print(abs(sum(sorted(L)[N-1:])))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M=map(int,input().split(" "))
#Nはポーンの数 Mは入力の数
A=list(sorted(map(int,input().split(" "))))
L=np.array([A[s]-A[s+1] for s in range(M-1)])

if M<=N:
    print(0)
else:
    for s in range(N-1):
        L[np.argmin(L)]=0
    print(abs(sum(L)))

Fixed submission:
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]
if M>N:
    print(abs(sum(sorted(L)[N-1:])))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M=map(int,input().split(" "))
#Nはポーンの数 Mは入力の数
A=list(sorted(map(int,input().split(" "))))
L=np.array([A[s]-A[s+1] for s in range(M-1)])

if M<=N:
    print(0)
else:
    for s in range(N-1):
        L=np.delete(L,np.argmin(L))
    print(abs(sum(L)))

Fixed submission:
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]
if M>N:
    print(abs(sum(sorted(L)[N-1:])))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split(" "))
#Nはポーンの数 Mは入力の数
A=sorted(map(int,input().split(" ")))
L=[list(A)[s]-list(A)[s+1] for s in range(M-1)]

if M<=N:
    print(0)
else:
    for s in range(N-1):
        L.remove(min(L))
    print(abs(sum(L)))

Fixed submission:
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]
if M>N:
    print(abs(sum(sorted(L)[N-1:])))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split(" "))
#Nはポーンの数 Mは入力の数
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]

if M<=N:
    print(0)
else:
    for s in range(N-1):
        L.remove(min(L))
    print(abs(sum(L)))

Fixed submission:
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]
if M>N:
    print(abs(sum(sorted(L)[N-1:])))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split(" "))
#Nはポーンの数 Mは入力の数
A=list(map(int,input().split(" ")))
A=sorted(A)
L=[A[s]-A[s+1] for s in range(M-1)]

if M<=N:
    print(0)
else:
    for s in range(N-1):
        L.remove(min(L))
    print(abs(sum(L)))

Fixed submission:
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]
if M>N:
    print(abs(sum(sorted(L)[N-1:])))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split(" "))
#Nはポーンの数 Mは入力の数
A=list(map(int,input().split(" ")))
A=sorted(A)
L=[]
for s in range(M-1):
    L.append(A[s]-A[s+1])
if M<=N:
    print(0)
else:
    for s in range(N-1):
        L.remove(min(L))
    print(abs(sum(L)))

Fixed submission:
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]
if M>N:
    print(abs(sum(sorted(L)[N-1:])))
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split(" "))
#Nはポーンの数 Mは入力の数
A=list(map(int,input().split(" ")).sort())
print(A)

Fixed submission:
N,M=map(int,input().split(" "))
A=list(sorted(map(int,input().split(" "))))
L=[A[s]-A[s+1] for s in range(M-1)]
if M>N:
    print(abs(sum(sorted(L)[N-1:])))
else:
    print(0)