#pragma GCC diagnostic warning "-Wextra"
#pragma GCC diagnostic warning "-Wshadow"
#include <bits/stdc++.h>
using namespace std;

template <class A, class B> bool cmin(A& a, B b) { return a > b && (a = b, true); }
template <class A, class B> bool cmax(A& a, B b) { return a < b && (a = b, true); }
template <class A, class B> ostream& operator<<(ostream& os, pair<A, B>& p) { return os << '(' << p.first << ", " << p.second << ')'; }
static bool debug = false;
void dump() {}
template <class A, class... B> void dump(A&& a, B&&... b) { if (debug) cout << a << (sizeof...(b) ? ' ' : '\n'), dump(b...); }
template <class A> void dump1D(A& a) { if (debug) for (auto i = a.begin(); i != a.end(); i++) cout << *i << (next(i) != a.end() ? ' ' : '\n'); }
template <class A> void dump2D(A& a) { if (debug) for (auto i = a.begin(); i != a.end(); i++) dump1D(*i), cout << (next(i) != a.end() ? '\0' : '\n'); }

signed main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  debug = true;

  long H, W;
  cin >> H >> W;
  vector<vector<char>> S(H, vector<char>(W));
  for (long i = 0; i < H; i++) {
    for (long j = 0; j < W; j++) {
      cin >> S.at(i).at(j);
    }
  }

  long ans = 0;
  for (long h = 0; h < H; h++) {
    for (long w = 0; w < W; w++) {
      long cnt = 0;
      for (long i = 0; i < 2; i++) {
        for (long j = 0; j < 2; j++) {
          if (h + i >= H) goto NG;
          if (w + j >= W) goto NG;
          cnt += S.at(h + i).at(w + j) == '#';
        }
      }
      if (cnt == 1 || cnt == 3) ans++;
      NG:;
    }
  }
  cout << ans << '\n';
}
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second

typedef long long lli;
typedef pair<int, int> pii;

const int mod = 1e9 + 7;

int n, m;
int total = 0;

void read_input()
{
    cin >> n >> m;
    for(int i = 1; i <= n; ++i)
    {
        int a;
        cin >> a;
        total += a;
    }
}

int powmod(int x, int k)
{
    if(k == 0) return 1;
    int t = powmod(x, k / 2);
    if(k % 2 == 0) return t * 1LL * t % mod;
    else return t * 1LL * t % mod * x % mod;
}

int inv(int x)
{
    return powmod(x, mod - 2);
}

int C(int k, int n)
{
    if(k > n) return 0;
    int res = 1;
    for(int i = n - k + 1; i <= n; ++i)
        res = res * 1LL * i % mod;
    for(int i = 1; i <= k; ++i)
        res = res * 1LL * inv(i) % mod;
    return res;
}

int calc(int k, int n)
{
    return C(k, n + k);
}

void solve()
{
    cout << calc(n + total, m - total) << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}

