#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   int n, k;   int a[2011];   long long pre[1 << 11 + 1];   long long cur[1 << 11 + 1];   void solve() {     memset(pre, 0, sizeof(pre));     pre[0] = 1;     for (int i = 0; i < n; i++) {       memset(cur, 0, sizeof(cur));       for (int j = 0; j < (1 << k) + 1; j++) {         if (a[i] == 2 || a[i] == 0) {           int nj = min(j + 2, 1 << k);           cur[nj] = (cur[nj] + pre[j]) % mod;         }         if (a[i] == 4 || a[i] == 0) {           int nj = min(j + 4, 1 << k);           if ((j & 2) != 0) {             nj = 4;           }           cur[nj] = (cur[nj] + pre[j]) % mod;         }       }       memcpy(pre, cur, sizeof(cur));     }     cout << pre[1 << k] << endl;   }   void coding() {     while (cin >> n >> k) {       for (int i = 0; i < n; i++) cin >> a[i];       solve();     }   }   int main() { coding(); }   