#include <bits/stdc++.h>
using namespace std;
inline long long int read() {
  long long int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const long long int MOD = 1e9 + 7, N = 112345;
int main() {
  long long int t = read(), n = read(), ans = 1;
  string s;
  set<int> x[n];
  while (t--) {
    cin >> s;
    for (int i = 0; i < n; i++) x[i].insert(s[i]);
  }
  for (auto item : x) ans = (ans * item.size()) % MOD;
  cout << ans << "\n";
  return 0;
}
