#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  long long int prime = 1e9 + 7;
  cin >> n >> m;
  string s;
  vector<vector<bool> > arr(m, vector<bool>(26, false));
  vector<long long int> cnt(m, 0);
  for (int i = 0; i < n; ++i) {
    cin >> s;
    for (int j = 0; j < m; ++j) {
      if (!arr[j][s[j] - 'A']) {
        cnt[j] += 1;
        arr[j][s[j] - 'A'] = true;
      }
    }
  }
  long long int ans = cnt[0];
  for (int i = 1; i < m; ++i) {
    ans = (ans * cnt[i]) % prime;
  }
  cout << ans << endl;
  return 0;
}
