You are given an integer m.

Let M = 2m - 1.

You are also given a set of n integers denoted as the set T. The integers will be provided in base 2 as n binary strings of length m.

A set of integers S is called "good" if the following hold. 

  1. If <image>, then <image>. 
  2. If <image>, then <image>
  3. <image>
  4. All elements of S are less than or equal to M. 



Here, <image> and <image> refer to the bitwise XOR and bitwise AND operators, respectively.

Count the number of good sets S, modulo 109 + 7.

Input

The first line will contain two integers m and n (1 ≤ m ≤ 1 000, 1 ≤ n ≤ min(2m, 50)).

The next n lines will contain the elements of T. Each line will contain exactly m zeros and ones. Elements of T will be distinct.

Output

Print a single integer, the number of good sets modulo 109 + 7. 

Examples

Input

5 3
11010
00101
11000


Output

4


Input

30 2
010101010101010010101010101010
110110110110110011011011011011


Output

860616440

Note

An example of a valid set S is {00000, 00101, 00010, 00111, 11000, 11010, 11101, 11111}.
#include <bits/stdc++.h>
using namespace std;
const int MAXM = 1e3 + 10;
const int MOD = 1e9 + 7;
void add(int& x, int y) { ((x += y) >= MOD) && (x -= MOD); }
int mul(int x, int y) { return x * 1ll * y % MOD; }
bitset<MAXM> readBitset() {
  string s;
  getline(cin, s);
  bitset<MAXM> b;
  for (int i = 0; i < int(((int)(s).size())); ++i) {
    if (s[i] == '1') {
      b.set(i);
    }
  }
  return b;
}
int m, n;
vector<bitset<MAXM>> a;
bool read() {
  if (scanf("%d%d\n", &m, &n) < 2) {
    return 0;
  }
  a.resize(n);
  for (int i = 0; i < int(n); ++i) {
    a[i] = readBitset();
  }
  return 1;
}
struct DSU {
  vector<int> par;
  DSU(int n = 0) { par.assign(n, -1); }
  int get(int x) { return par[x] < 0 ? x : par[x] = get(par[x]); }
  bool unite(int x, int y) {
    x = get(x);
    y = get(y);
    if (x == y) {
      return 0;
    }
    if (-par[x] < -par[y]) {
      swap(x, y);
    }
    par[x] += par[y];
    par[y] = x;
    return 1;
  }
};
int solve() {
  DSU dsu(m);
  for (int i = 0; i < int(m); ++i) {
    bitset<MAXM> and_with;
    for (int j = 0; j < int(m); ++j) {
      and_with.set(j);
    }
    for (const auto& b : a) {
      if (b[i]) {
        and_with &= b;
      } else {
        and_with &= ~b;
      }
    }
    assert(and_with[i]);
    for (int j = 0; j < int(m); ++j) {
      if (and_with[j]) {
        dsu.unite(i, j);
      }
    }
  }
  vector<int> sizes;
  for (int i = 0; i < int(m); ++i) {
    if (dsu.get(i) == i) {
      sizes.push_back(-dsu.par[i]);
    }
  }
  sort(begin(sizes), end(sizes));
  assert(accumulate(begin(sizes), end(sizes), 0) == m);
  ;
  ;
  for (int i = 0; i < int(((int)(sizes).size())); ++i) {
    ;
    ;
  };
  ;
  vector<int> color(m + 1, -1);
  int ptr = 0;
  for (int i = 0; i < int(((int)(sizes).size())); ++i) {
    for (int j = ptr; j < ptr + sizes[i]; ++j) {
      color[j] = i;
    }
    ptr += sizes[i];
  }
  assert(ptr == m);
  static int dp[MAXM][MAXM];
  memset(dp, 0, sizeof dp);
  dp[0][0] = 1;
  for (int i = 0; i < int(m); ++i) {
    for (int cnt = 0; cnt < int(m + 1); ++cnt) {
      const int cur_dp = dp[i][cnt];
      if (!cur_dp) {
        continue;
      }
      const bool same = color[i] == color[i + 1];
      add(dp[i + 1][same ? (cnt + 1) : 0], cur_dp);
      add(dp[i + 1][same ? cnt : 0], mul(cur_dp, cnt));
    }
  }
  return dp[m][0];
}
int main() {
  while (read()) {
    printf("%d\n", solve());
  }
  return 0;
}
