#include <bits/stdc++.h>
using namespace std;
template <typename T>
T abs(T a) {
  return a < 0 ? -a : a;
}
template <typename T>
T sqr(T a) {
  return a * a;
}
const int INF = (int)1e9;
const long double EPS = 1e-9;
const long double PI = 3.1415926535897932384626433832795;
int main() {
  long long n, m;
  cin >> n >> m;
  string *s = new string[n];
  string tmp;
  for (long long i = 0; i < n; i++) {
    cin >> s[i];
    tmp += " ";
  }
  string *s1 = new string[m];
  for (long long j = 0; j < m; j++) s1[j] = tmp;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) s1[j][i] = s[i][j];
  for (long long j = 0; j < m; j++) {
    sort(&(s1[j][0]), &(s1[j][0]) + n);
    s1[j] = s1[j] + "!";
  }
  long long *k = new long long[m];
  for (long long j = 0; j < m; j++) {
    long long tmp = 0;
    for (int i = 0; i < n; i++)
      if (s1[j][i] != s1[j][i + 1]) tmp++;
    k[j] = tmp;
  }
  long long sum = 1, d = 1000000007;
  for (long long j = 0; j < m; j++) sum = ((sum % d) * (k[j] % d)) % d;
  cout << sum % d << endl;
  return 0;
}
