#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
const int md = 1e9 + 7;
string s[maxn];
long long dp[maxn], cnt[maxn][maxn], n, m, sz[maxn], re;
bool vis[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> m >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }
  cnt[0][0] = 1;
  for (int i = 1; i < m + 1; ++i) {
    cnt[i][i] = cnt[i][0] = 1;
    for (int j = 1; j < i; ++j) {
      cnt[i][j] = (cnt[i - 1][j] + cnt[i - 1][j - 1]) % md;
    }
  }
  dp[0] = 1;
  for (int i = 1; i < m + 1; ++i) {
    for (int j = 0; j < i; ++j) {
      dp[i] = (dp[i] + dp[i - j - 1] * cnt[i - 1][j]) % md;
    }
  }
  re = 1;
  for (int i = 0; i < m; ++i) {
    if (vis[i]) continue;
    sz[i] = 1;
    for (int j = i + 1; j < m; ++j) {
      bool f = true;
      for (int k = 0; k < n; ++k) {
        if (s[k][i] != s[k][j]) {
          f = false;
          break;
        }
      }
      if (f) {
        sz[i]++;
        vis[j] = true;
      }
    }
    re = (re * dp[sz[i]]) % md;
  }
  cout << re;
  return 0;
}
