#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef pair pii; typedef vector vll; typedef vector vi; typedef vector> vvi; typedef vector> vvll; const ll inf = 1e16; const ll md = 1000000007; int main() { int b,n; vi cc; cin>>b>>n; ll s=0LL; rep(_,n){ int c; cin>>c; cc.push_back(c); s+=c; } s/=n; ll ans=0LL; for(int c:cc){ ans+=abs(c-s); } cout<