import Foundation

let kn = readLine()!.componentsSeparatedByString(" ").map({ Int($0)!})
let k = kn[0]
let n = kn[1]

var inputA = readLine()!.componentsSeparatedByString(" ").map({ Int($0)!})
inputA = inputA.map({
    if $0 > 10 {
        return $0 - 20
    } else {
        return $0
    }
})
inputA = inputA.sort{ $0 < $1 }  
print(inputA.last! - inputA.first!)