func_code_string: #include <bits/stdc++.h>   const int N = 100, M = 1000;   int n, m;   double dp[N + 2][N * M + 2];   int main() {     scanf( %d %d , &n, &m);     if (m == 1) {       printf( 1.0 );       return 0;     }     dp[0][0] = m - 1;     int sumr = 0;     for (int i = 1; i <= n; i++) {       int rank;       scanf( %d , &rank);       sumr += rank;       double sum = 0.0;       for (int j = 1; j <= n * m; j++) {         sum += dp[i - 1][j - 1];         if (j > m) sum -= dp[i - 1][j - m - 1];         if (j >= rank)           dp[i][j] = (sum - dp[i - 1][j - rank]) / (m - 1);         else           dp[i][j] = sum / (m - 1);       }     }     double ans = 1.0;     for (int i = 1; i < sumr; i++) ans += dp[n][i];     printf( %.10lf , ans);     return 0;   }   