#include <bits/stdc++.h>
using namespace std;
template <class T1>
void deb(T1 e1) {
  cout << e1 << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
template <typename T>
T gcd(T a, T b) {
  while (b) {
    T t = a % b;
    a = b;
    b = t;
  }
  return a;
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <typename T>
T gcd(T a, T b, T c) {
  return gcd(gcd(a, b), c);
}
template <typename T>
bool isPrime(T x) {
  if (x <= 4 || x % 2 == 0 || x % 3 == 0) return x == 2 || x == 3;
  for (T i = 5; i * i <= x; i += 6)
    if (x % i == 0 || x % (i + 2) == 0) return 0;
  return 1;
}
template <typename T>
bool bitcheck(T p, T pos) {
  return (bool)(p & (1 << pos));
}
template <typename T>
T biton(T p, T pos) {
  return p = p | (1 << pos);
}
template <typename T>
T bitoff(T p, T pos) {
  return p = p & ~(1 << pos);
}
template <typename T>
long long int toint(T s) {
  long long int p;
  stringstream ss(s);
  ss >> p;
  return p;
}
template <typename T>
string tostring(T n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
template <typename T>
T POW(T b, T p) {
  T Ans = 1;
  while (p) {
    if (p & 1) Ans = (Ans * b);
    b = (b * b);
    p >>= 1;
  }
  return Ans;
}
template <typename T>
T BigMod(T b, T p, T Mod) {
  T Ans = 1;
  while (p) {
    if (p & 1) Ans = (Ans * b) % Mod;
    b = (b * b) % Mod;
    p >>= 1;
  }
  return Ans;
}
template <typename T>
T ModInverse(T p, T Mod) {
  return BigMod(p, Mod - 2, Mod);
}
const int mx = 2e5 + 5;
bool mark[mx];
void sieve() {
  memset(mark, true, sizeof(mark));
  for (long long int i = 3; i <= (long long int)sqrt(mx); i += 2) {
    if (mark[i]) {
      for (long long int j = i * i; j <= mx; j += 2 * i) mark[j] = false;
    }
  }
}
int a[mx];
int n, m, c;
long long int mod = 1e9 + 7;
long long int l[mx], r[mx];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  cin >> n >> m;
  string a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int ans = 1;
  for (int j = 0; j < m; j++) {
    set<char> s;
    for (int i = 0; i < n; i++) {
      s.insert(a[i][j]);
    }
    ans = (ans * s.size()) % mod;
  }
  cout << ans << '\n';
}
