#include "bits/stdc++.h" using namespace std; using LLI = long long; #define INF 999999999 #define MOD 1000000007 #define FOR(i, s, e) for(LLI i = s, i##_lim = (e); i < i##_lim; i++) #define FORR(i, s, e) for(LLI i = s-1, i##_lim = (e); i##_lim<=i; i--) #define REP(i, n) FOR(i,0,n) #define REPR(i, n) FORR(i,n,0) #define chmax(a, b) a = max(a, b) #define chmin(a, b) a = min(a, b) #define bit(a, shift) ((a>>shift)&1)) #define pm(a) ((a)?1:-1) #define SORT(v) sort(v.begin(),v.end()) #define RSORT(v) sort((v).rbegin(), (v).rend()) #define Mat2(type,name,h,w,def) vector> name(h,vector(w, def)) #define Mat3(type,name,h,w,d,def) vector>> name(h,vector>(w, vector(d,def))) // int 2.14E±9 LLIi 9.2E±18 double 1.7E±380 int main() { cout << fixed << setprecision(10); LLI n, x; cin >> n >> x; LLI sum = 0; REP(i, n) { LLI s; cin >> s; sum += s; } cout << sum % x; return 0; }