#include <iostream> using namespace std; int main(){ int n,x; cin >> n >> x; int sum = 0; for(int i = 0 ; i < n ; ++ i){ int number; cin>> number; sum +=number; } if(sum < 0) sum = -sum; cout<<(sum%x ? sum/x+1 : sum/x) <<endl; }
#include <iostream> using namespace std; int main(){ int n,x; cin >> n >> x; int sum = 0; for(int i = 0 ; i < n ; ++ i){ int number; cin>> number; sum +=number; } if(sum < 0) sum = -sum; cout<<(sum%x ? sum/x+1 : sum/x) <<endl; }