#include #define INIT std::ios::sync_with_stdio(false);std::cin.tie(0); #define VAR(type, a) type a;std::cin>>a; // VAR(int, x); #define OUT(d) std::cout<<(d); #define SP std::cout<<" "; #define ENDL std::cout<<"\n"; #define VEC(type, c, n) std::vector c(n);for(auto& i:c)std::cin>>i; #define MAT(type, c, m, n) std::vector> c(m, std::vector(n));for(auto& r:c)for(auto& i:r)std::cin>>i; #define ALL(a) (a).begin(),(a).end() #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--) #define REP(i,n) for (int i=0;i<(n);i++) #define RREP(i,n) for (int i=(n)-1;i>=0;i--) using ll = long long; int main(){ INIT; VAR(int, n);VAR(int, m); VEC(int, d, m); std::sort(ALL(d)); int l = 0, r = n-1; int ans = 100000; int zero = -1; REP(i, m){ if(d[i]==0){ zero=i; break; } } for(; r=0) tmp = d[r]-0; else tmp = d[r]-d[l]+((zero!=-1)?2:1)+std::min(std::fabs(d[l]), std::fabs(d[r]))-1; ans = std::min(ans, tmp); } OUT(ans)ENDL; return 0; }