/**
 *    author: chowgz
 *    created: 22/12/2020 02:09:09
**/
#include <bits/stdc++.h>

using namespace std;

#define p 1000000007

inline static long long invmod(long long a) {
	long long res = 1, b = p - 2;
	while (b != 0) {
		if (b & 1) {
			res = res * a % p;
		}
		a = a * a % p;
		b >>= 1;
	}
	return res;
}

inline static long long nCr(int n, int r) {
	long long num = 1, den = 1;
	r = min(r, n - r);
	n++;
	for (int i = 1; i <= r; i++) {
		num = num * (n - i) % p;
		den = den * i % p;
	}
	long long res = num * invmod(den) % p;
	if (res < 0) res += p;
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	int arr[n], sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		sum += arr[i];
	}
	if (m < sum) {
		cout << 0;
		return 0;
	}
	m += n;
	sum += n;
	cout << nCr(m, sum);
	return 0;
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> edge(n, 0);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    edge.at(a) |= (1 << b);
    edge.at(b) |= (1 << a);
  }

  vector<int> dp(1 << n, 1001001001);
  dp.at(0) = 0;
  rep2(bit, 1, 1 << n) {
    rep(i, n) {
      if((bit & (1 << i)) != 0) {
        int j = bit - (1 << i);
        if(dp.at(j) <= 1 && ((edge.at(i) & j) == j)) {
          dp.at(bit) = 1;
        }
        break;
      }
    }
  }

  rep(bit, 1 << n) {
    for(int i = bit; i > 0; i = ((i-1) & bit)) {
      int j = bit - i;
      dp.at(bit) = min(dp.at(bit), dp.at(i) + dp.at(j));
    }
  }
  // rep(i, dp.size()) {
  //   cerr << (dp.at(i) == 1001001001 ? -1 : dp.at(i)) << " ";
  // }
  // cerr << endl;
  cout << dp.back() << endl;
  return 0;
}