#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int n, m;
  cin >> n >> m;
  char s[n][m];
  for (int i = 0; i < n; i++) {
    scanf(" %s", &s[i]);
  }
  long long ans = 1;
  for (int i = 0; i < m; i++) {
    int dis = 0, ar[26];
    fill(ar, ar + 26, 0);
    for (int j = 0; j < n; j++) {
      ar[s[j][i] - 'A']++;
      if (ar[s[j][i] - 'A'] == 1) dis++;
    }
    ans = (ans * dis) % MOD;
  }
  cout << ans;
  return 0;
}
