func_code_string: #include <bits/stdc++.h>   using namespace std;   long long read() {     long long num = 0;     int fix = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) fix = -1;       ch = getchar();     }     while (isdigit(ch)) {       num = num * 10 + ch -  0 ;       ch = getchar();     }     return num * fix;   }   const int mod = 1e9 + 7;   const int MAXN = 50;   int N, K;   int W[MAXN + 1];   long long fact[MAXN + 1], inv[MAXN + 1];   struct data {     int x, y, pos;   };   long long power(long long x, long long y) {     long long res = 1;     while (y) {       if (y & 1) res = res * x % mod;       x = x * x % mod;       y >>= 1;     }     return res;   }   void initial() {     fact[0] = 1;     for (int i = 1; i <= MAXN; i++) {       fact[i] = fact[i - 1] * i % mod;     }     inv[MAXN] = power(fact[MAXN], mod - 2);     for (int i = MAXN - 1; i >= 0; i--) {       inv[i] = inv[i + 1] * (i + 1) % mod;     }   }   int flag = -1;   int dp[MAXN + 1][MAXN + 1][2];   long long num[MAXN + 1][MAXN + 1][2];   long long C(int x, int y) { return fact[y] * inv[x] % mod * inv[y - x] % mod; }   void BFS(int a, int b) {     memset(dp, -1, sizeof(dp));     dp[a][b][0] = 0, num[a][b][0] = 1;     queue<data> que;     que.push((data){a, b, 0});     while (!que.empty()) {       if (flag != -1 && que.front().pos == flag) break;       data cur = que.front();       que.pop();       int x, y, fix;       if (cur.pos)         x = a - cur.x, y = b - cur.y, fix = 1;       else         x = cur.x, y = cur.y, fix = -1;       for (int i = 0; i <= x; i++) {         for (int j = 0; j <= y; j++) {           if (i + j == 0) continue;           if (i * 50 + j * 100 > K) continue;           int newx = cur.x + i * fix, newy = cur.y + j * fix;           if (dp[newx][newy][cur.pos ^ 1] != -1) {             if (dp[newx][newy][cur.pos ^ 1] == dp[cur.x][cur.y][cur.pos] + 1) {               (num[newx][newy][cur.pos ^ 1] +=                num[cur.x][cur.y][cur.pos] * C(i, x) % mod * C(j, y) % mod) %= mod;             }             continue;           }           dp[newx][newy][cur.pos ^ 1] = dp[cur.x][cur.y][cur.pos] + 1;           num[newx][newy][cur.pos ^ 1] =               num[cur.x][cur.y][cur.pos] * C(i, x) % mod * C(j, y) % mod;           if (newx + newy == 0) {             flag = !cur.pos;           }           que.push((data){newx, newy, cur.pos ^ 1});         }       }     }   }   void solve() {     int cnt50 = 0, cnt100 = 0;     for (int i = 1; i <= N; i++) {       if (W[i] == 50) cnt50++;       if (W[i] == 100) cnt100++;     }     BFS(cnt50, cnt100);     if (flag == -1) {       puts( -1 );       puts( 0 );       return;     }     printf( %d n , dp[0][0][flag]);     printf( %lld n , num[0][0][flag]);   }   int main() {     initial();     N = read(), K = read();     for (int i = 1; i <= N; i++) {       W[i] = read();     }     solve();     return 0;   }   