func_code_string: #include <bits/stdc++.h>   using namespace std;   const long double PI = 3.14159265359;   const long long MOD = (long long)1e9 + 7;   const long long MAXN = (long long)2e3 + 10;   const long long INF = (long long)2242545357980376863;   const long double EPS = (long double)1e-8;   long long dp[MAXN][2048];   long long pw[MAXN], cnt[MAXN];   long long a[MAXN];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     pw[0] = 1;     for (int i = 1; i < MAXN; i++) pw[i] = (pw[i - 1] << 1) % MOD;     long long n, k;     cin >> n >> k;     k = (1ll << k);     for (int i = 1; i <= n; i++) cin >> a[i];     long long c0 = 0;     for (int i = n; i >= 0; i--) {       cnt[i] = c0;       if (a[i] == 0) c0++;     }     if (a[1] == 2) {       dp[1][2] = 1;     }     if (a[1] == 4) {       dp[1][4] = 1;     }     if (a[1] == 0) {       dp[1][2] = dp[1][4] = 1;     }     long long ans = 0;     for (int i = 1; i < n; i++) {       for (int j = 2; j < 2048; j++) {         if (dp[i][j] == 0) continue;         long long nx = a[i + 1];         if (nx != 4) {           long long sm = j + 2;           if (sm >= k) {             ans += (pw[cnt[i + 1]] * dp[i][j]);             ans %= MOD;           } else {             dp[i + 1][sm] += dp[i][j];             dp[i + 1][sm] %= MOD;           }         }         if (nx != 2) {           if (j % 4 == 2) {             dp[i + 1][4] += dp[i][j];           } else {             long long sm = j + 4;             if (sm >= k) {               ans += (pw[cnt[i + 1]] * dp[i][j]);               ans %= MOD;             } else {               dp[i + 1][sm] += dp[i][j];               dp[i + 1][sm] %= MOD;             }           }         }       }     }     cout << ans;     return 0;   }   