func_code_string: #include <bits/stdc++.h>   using namespace std;   double dp[105][105 * 1005];   int a[105];   int main(void) {     int n, m;     scanf( %d%d , &n, &m);     int sum = 0;     for (int i = 0; i < n; ++i) {       scanf( %d , &a[i]);       sum += a[i];     }     if (m == 1) {       printf( %.10f n , 1.0);       return 0;     }     dp[0][0] = m - 1;     for (int i = 1; i <= n; ++i) {       double sum = 0;       for (int j = i; j <= i * m; ++j) {         sum += dp[i - 1][j - 1] / (m - 1);         if (j - 1 - m >= 0) sum -= dp[i - 1][j - m - 1] / (m - 1);         dp[i][j] = sum;         if (j - a[i - 1] >= 0) dp[i][j] -= dp[i - 1][j - a[i - 1]] / (m - 1);       }     }     double ans = 1;     for (int i = 0; i < sum; i++) ans += dp[n][i];     printf( %.10f n , ans);     return 0;   }   