func_code_string: #include <bits/stdc++.h>   using namespace std;   #pragma GCC optimize( O2,no-stack-protector,unroll-loops,fast-math )   const long long maxn = 1e5 + 10, maxm = 5e2 + 10, lg = 21, mod = 1e9 + 7,                   inf = 1e18;   long long n, m, s;   long double dp[101][maxn], ps[maxn];   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n >> m;     if (m == 1) return cout << 1, 0;     dp[0][0] = m - 1;     fill(ps, ps + maxn, m - 1);     for (int i = 1; i <= n; i++) {       long long x;       cin >> x;       s += x;       for (int j = 1; j <= n * m; j++)         dp[i][j] = (ps[j - 1] - (j - m - 1 >= 0 ? ps[j - m - 1] : 0) -                     (j - x >= 0 ? dp[i - 1][j - x] : 0)) /                    (m - 1);       ps[0] = 0;       for (int j = 1; j <= n * m; j++) ps[j] = ps[j - 1] + dp[i][j];     }     cout << fixed << setprecision(18) << ps[s - 1] + 1;     return 0;   }   