#include <bits/stdc++.h>
using namespace std;
vector<string> a;
long long int mod = 1e9 + 7;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    string b;
    cin >> b;
    a.push_back(b);
  }
  long long int ans = 1;
  for (int i = 0; i < m; i++) {
    long long int temp[26] = {0}, count = 0;
    for (int j = 0; j < n; j++) {
      if (temp[a[j][i] - 'A'] == 0) temp[a[j][i] - 'A']++;
    }
    for (int j = 0; j < 26; j++)
      if (temp[j] == 1) count++;
    ans = (ans * (count % mod)) % mod;
  }
  cout << ans << endl;
  return 0;
}
